Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
faa7a555
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
faa7a555
编写于
2月 25, 2021
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change
上级
cd05259c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
15 deletion
+16
-15
src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractConnection.java
...c/src/main/java/com/taosdata/jdbc/AbstractConnection.java
+5
-4
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBError.java
...ector/jdbc/src/main/java/com/taosdata/jdbc/TSDBError.java
+9
-8
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java
...dbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java
+2
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
...r/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
+0
-3
未找到文件。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractConnection.java
浏览文件 @
faa7a555
...
...
@@ -436,7 +436,7 @@ public abstract class AbstractConnection extends WrapperImpl implements Connecti
@Override
public
void
setClientInfo
(
String
name
,
String
value
)
throws
SQLClientInfoException
{
if
(
isClosed
)
throw
TSDBError
.
createSQLClientInfoException
(
TSDBErrorNumbers
.
ERROR
_CONNECTION_CLOSED
);
throw
(
SQLClientInfoException
)
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_SQLCLIENT_EXCEPTION_ON
_CONNECTION_CLOSED
);
if
(
clientInfoProps
==
null
)
clientInfoProps
=
new
Properties
();
...
...
@@ -446,7 +446,8 @@ public abstract class AbstractConnection extends WrapperImpl implements Connecti
@Override
public
void
setClientInfo
(
Properties
properties
)
throws
SQLClientInfoException
{
if
(
isClosed
)
throw
TSDBError
.
createSQLClientInfoException
(
TSDBErrorNumbers
.
ERROR_CONNECTION_CLOSED
);
throw
(
SQLClientInfoException
)
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_SQLCLIENT_EXCEPTION_ON_CONNECTION_CLOSED
);
for
(
Enumeration
<
Object
>
enumer
=
properties
.
keys
();
enumer
.
hasMoreElements
();
)
{
String
name
=
(
String
)
enumer
.
nextElement
();
...
...
@@ -457,7 +458,7 @@ public abstract class AbstractConnection extends WrapperImpl implements Connecti
@Override
public
String
getClientInfo
(
String
name
)
throws
SQLException
{
if
(
isClosed
)
throw
TSDBError
.
createSQL
ClientInfo
Exception
(
TSDBErrorNumbers
.
ERROR_CONNECTION_CLOSED
);
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_CONNECTION_CLOSED
);
return
clientInfoProps
.
getProperty
(
name
);
}
...
...
@@ -465,7 +466,7 @@ public abstract class AbstractConnection extends WrapperImpl implements Connecti
@Override
public
Properties
getClientInfo
()
throws
SQLException
{
if
(
isClosed
)
throw
TSDBError
.
createSQL
ClientInfo
Exception
(
TSDBErrorNumbers
.
ERROR_CONNECTION_CLOSED
);
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_CONNECTION_CLOSED
);
return
clientInfoProps
;
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBError.java
浏览文件 @
faa7a555
...
...
@@ -23,6 +23,7 @@ public class TSDBError {
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_INVALID_FOR_EXECUTE_UPDATE
,
"not a valid sql for executeUpdate: (?)"
);
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_INVALID_FOR_EXECUTE
,
"not a valid sql for execute: (?)"
);
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_PARAMETER_INDEX_OUT_RANGE
,
"parameter index out of range"
);
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_SQLCLIENT_EXCEPTION_ON_CONNECTION_CLOSED
,
"connection already closed"
);
/**************************************************/
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_UNKNOWN
,
"unknown error"
);
...
...
@@ -48,24 +49,24 @@ public class TSDBError {
}
public
static
SQLException
createSQLException
(
int
errorNumber
,
String
message
)
{
if
(
message
==
null
||
message
.
isEmpty
())
{
if
(
message
==
null
||
message
.
isEmpty
()
||
message
.
replaceAll
(
"\\s"
,
""
).
isEmpty
()
)
{
if
(
TSDBErrorNumbers
.
contains
(
errorNumber
))
message
=
TSDBErrorMap
.
get
(
errorNumber
);
else
message
=
TSDBErrorMap
.
get
(
TSDBErrorNumbers
.
ERROR_UNKNOWN
);
}
// throw SQLFeatureNotSupportedException
if
(
errorNumber
==
TSDBErrorNumbers
.
ERROR_UNSUPPORTED_METHOD
)
return
new
SQLFeatureNotSupportedException
(
message
);
return
new
SQLFeatureNotSupportedException
(
message
,
""
,
errorNumber
);
// throw SQLClientInfoException
if
(
errorNumber
==
TSDBErrorNumbers
.
ERROR_SQLCLIENT_EXCEPTION_ON_CONNECTION_CLOSED
)
return
new
SQLClientInfoException
(
message
,
null
);
if
(
errorNumber
<
TSDBErrorNumbers
.
ERROR_UNKNOWN
)
// JDBC exception's error number is less than 0x2350
return
new
SQLException
(
"ERROR ("
+
Integer
.
toHexString
(
errorNumber
)
+
"): "
+
message
);
return
new
SQLException
(
"ERROR ("
+
Integer
.
toHexString
(
errorNumber
)
+
"): "
+
message
,
""
,
errorNumber
);
// JNI exception's error number is large than 0x2350
return
new
SQLException
(
"TDengine ERROR ("
+
Integer
.
toHexString
(
errorNumber
)
+
"): "
+
message
);
return
new
SQLException
(
"TDengine ERROR ("
+
Integer
.
toHexString
(
errorNumber
)
+
"): "
+
message
,
""
,
errorNumber
);
}
public
static
SQLClientInfoException
createSQLClientInfoException
(
int
errorNumber
)
{
return
new
SQLClientInfoException
();
}
}
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java
浏览文件 @
faa7a555
...
...
@@ -17,6 +17,7 @@ public class TSDBErrorNumbers {
public
static
final
int
ERROR_INVALID_FOR_EXECUTE_UPDATE
=
0x2311
;
//not a valid sql for executeUpdate: (SQL)
public
static
final
int
ERROR_INVALID_FOR_EXECUTE
=
0x2312
;
//not a valid sql for execute: (SQL)
public
static
final
int
ERROR_PARAMETER_INDEX_OUT_RANGE
=
0x2313
;
// parameter index out of range
public
static
final
int
ERROR_SQLCLIENT_EXCEPTION_ON_CONNECTION_CLOSED
=
0x2314
;
// connection already closed
public
static
final
int
ERROR_UNKNOWN
=
0x2350
;
//unknown error
...
...
@@ -47,6 +48,7 @@ public class TSDBErrorNumbers {
errorNumbers
.
add
(
ERROR_INVALID_FOR_EXECUTE_UPDATE
);
errorNumbers
.
add
(
ERROR_INVALID_FOR_EXECUTE
);
errorNumbers
.
add
(
ERROR_PARAMETER_INDEX_OUT_RANGE
);
errorNumbers
.
add
(
ERROR_SQLCLIENT_EXCEPTION_ON_CONNECTION_CLOSED
);
/*****************************************************/
errorNumbers
.
add
(
ERROR_SUBSCRIBE_FAILED
);
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
浏览文件 @
faa7a555
...
...
@@ -21,9 +21,6 @@ import java.sql.SQLException;
public
class
TSDBStatement
extends
AbstractStatement
{
private
TSDBJNIConnector
connector
;
/**
* To store batched commands
*/
/**
* Status of current statement
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录