Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小楼昨夜-听风雨
TDengine
提交
52e62cf1
T
TDengine
项目概览
小楼昨夜-听风雨
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
52e62cf1
编写于
2月 03, 2021
作者:
H
huili
提交者:
GitHub
2月 03, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5118 from taosdata/feature/TD-2005
Feature/td 2005
上级
91a3148a
3f7c27b2
变更
5
展开全部
显示空白变更内容
内联
并排
Showing
5 changed file
with
268 addition
and
84 deletion
+268
-84
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBConnection.java
.../jdbc/src/main/java/com/taosdata/jdbc/TSDBConnection.java
+202
-70
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBConstants.java
...r/jdbc/src/main/java/com/taosdata/jdbc/TSDBConstants.java
+3
-3
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBError.java
...ector/jdbc/src/main/java/com/taosdata/jdbc/TSDBError.java
+31
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java
...dbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java
+15
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
...r/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
+17
-11
未找到文件。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBConnection.java
浏览文件 @
52e62cf1
此差异已折叠。
点击以展开。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBConstants.java
浏览文件 @
52e62cf1
...
...
@@ -19,12 +19,12 @@ import java.util.Map;
public
abstract
class
TSDBConstants
{
public
static
final
String
STATEMENT_CLOSED
=
"Statement already closed."
;
public
static
final
String
DEFAULT_PORT
=
"6200"
;
public
static
final
String
STATEMENT_CLOSED
=
"statement is closed"
;
public
static
final
String
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
=
"this operation is NOT supported currently!"
;
public
static
final
String
INVALID_VARIABLES
=
"invalid variables"
;
public
static
final
String
RESULT_SET_IS_CLOSED
=
"resultSet is closed
.
"
;
public
static
final
String
RESULT_SET_IS_CLOSED
=
"resultSet is closed"
;
public
static
final
String
DEFAULT_PORT
=
"6200"
;
public
static
Map
<
Integer
,
String
>
DATATYPE_MAP
=
null
;
public
static
final
long
JNI_NULL_POINTER
=
0L
;
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBError.java
0 → 100644
浏览文件 @
52e62cf1
package
com.taosdata.jdbc
;
import
java.sql.SQLException
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
TSDBError
{
private
static
Map
<
Integer
,
String
>
TSDBErrorMap
=
new
HashMap
<>();
static
{
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_CONNECTION_CLOSED
,
"connection already closed"
);
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_UNSUPPORTED_METHOD
,
"this operation is NOT supported currently!"
);
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_INVALID_VARIABLE
,
"invalid variables"
);
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_STATEMENT_CLOSED
,
"statement is closed"
);
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_RESULTSET_CLOSED
,
"resultSet is closed"
);
/**************************************************/
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_SUBSCRIBE_FAILED
,
"failed to create subscription"
);
}
public
static
String
wrapErrMsg
(
String
msg
)
{
return
"TDengine Error: "
+
msg
;
}
public
static
SQLException
createSQLException
(
int
errorNumber
)
{
// JDBC exception code is less than 0x2350
if
(
errorNumber
<=
0x2350
)
return
new
SQLException
(
TSDBErrorMap
.
get
(
errorNumber
));
// JNI exception code is
return
new
SQLException
(
wrapErrMsg
(
TSDBErrorMap
.
get
(
errorNumber
)));
}
}
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java
0 → 100644
浏览文件 @
52e62cf1
package
com.taosdata.jdbc
;
public
class
TSDBErrorNumbers
{
public
static
final
int
ERROR_CONNECTION_CLOSED
=
0x2301
;
// connection already closed
public
static
final
int
ERROR_UNSUPPORTED_METHOD
=
0x2302
;
//this operation is NOT supported currently!
public
static
final
int
ERROR_INVALID_VARIABLE
=
0x2303
;
//invalid variables
public
static
final
int
ERROR_STATEMENT_CLOSED
=
0x2304
;
//statement already closed
public
static
final
int
ERROR_RESULTSET_CLOSED
=
0x2305
;
//resultSet is closed
public
static
final
int
ERROR_SUBSCRIBE_FAILED
=
0x2350
;
//failed to create subscription
private
TSDBErrorNumbers
()
{
}
}
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
浏览文件 @
52e62cf1
...
...
@@ -22,7 +22,6 @@ import java.util.List;
public
class
TSDBStatement
implements
Statement
{
private
TSDBJNIConnector
connector
;
private
TaosInfo
taosInfo
=
TaosInfo
.
getInstance
();
/**
* To store batched commands
...
...
@@ -69,13 +68,12 @@ public class TSDBStatement implements Statement {
}
public
ResultSet
executeQuery
(
String
sql
)
throws
SQLException
{
if
(
isClosed
)
{
throw
new
SQLException
(
"Invalid method call on a closed statement."
);
if
(
isClosed
()
)
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_STATEMENT_CLOSED
);
}
// TODO make sure it is not a update query
pSql
=
this
.
connector
.
executeQuery
(
sql
);
long
resultSetPointer
=
this
.
connector
.
getResultSet
();
if
(
resultSetPointer
==
TSDBConstants
.
JNI_CONNECTION_NULL
)
{
this
.
connector
.
freeResultSet
(
pSql
);
...
...
@@ -100,8 +98,8 @@ public class TSDBStatement implements Statement {
}
public
int
executeUpdate
(
String
sql
)
throws
SQLException
{
if
(
isClosed
)
{
throw
new
SQLException
(
"Invalid method call on a closed statement."
);
if
(
isClosed
()
)
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_STATEMENT_CLOSED
);
}
// TODO check if current query is update query
...
...
@@ -133,25 +131,33 @@ public class TSDBStatement implements Statement {
}
public
int
getMaxFieldSize
()
throws
SQLException
{
if
(
isClosed
())
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_STATEMENT_CLOSED
);
}
return
0
;
// throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
}
public
void
setMaxFieldSize
(
int
max
)
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
if
(
isClosed
())
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_STATEMENT_CLOSED
);
}
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
getMaxRows
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
if
(
isClosed
())
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_STATEMENT_CLOSED
);
}
// always set maxRows to zero, meaning unlimitted rows in a resultSet
return
0
;
}
public
void
setMaxRows
(
int
max
)
throws
SQLException
{
if
(
isClosed
())
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_STATEMENT_CLOSED
);
}
// always set maxRows to zero, meaning unlimited rows in a resultSet
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录