Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b9da747d
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b9da747d
编写于
1月 26, 2021
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change
上级
3c83219f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
30 addition
and
25 deletion
+30
-25
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBConstants.java
...r/jdbc/src/main/java/com/taosdata/jdbc/TSDBConstants.java
+1
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
...r/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
+5
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
.../src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
+23
-24
src/connector/jdbc/src/test/java/com/taosdata/jdbc/StatementTest.java
...r/jdbc/src/test/java/com/taosdata/jdbc/StatementTest.java
+1
-1
未找到文件。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBConstants.java
浏览文件 @
b9da747d
...
...
@@ -19,6 +19,7 @@ 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
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
=
"this operation is NOT supported currently!"
;
public
static
final
String
INVALID_VARIABLES
=
"invalid variables"
;
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
浏览文件 @
b9da747d
...
...
@@ -136,10 +136,15 @@ public class TSDBStatement implements Statement {
}
public
void
setMaxFieldSize
(
int
max
)
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
getMaxRows
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
// always set maxRows to zero, meaning unlimitted rows in a resultSet
return
0
;
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
浏览文件 @
b9da747d
...
...
@@ -14,7 +14,6 @@ import java.util.stream.Collectors;
public
class
RestfulStatement
implements
Statement
{
private
static
final
String
STATEMENT_CLOSED
=
"Statement already closed."
;
private
boolean
closed
;
private
String
database
;
private
final
RestfulConnection
conn
;
...
...
@@ -131,14 +130,14 @@ public class RestfulStatement implements Statement {
@Override
public
int
getMaxFieldSize
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
return
TSDBConstants
.
maxFieldSize
;
}
@Override
public
void
setMaxFieldSize
(
int
max
)
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
if
(
max
<
0
)
throw
new
SQLException
(
TSDBConstants
.
INVALID_VARIABLES
);
// nothing to do
...
...
@@ -147,14 +146,14 @@ public class RestfulStatement implements Statement {
@Override
public
int
getMaxRows
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
return
0
;
}
@Override
public
void
setMaxRows
(
int
max
)
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
if
(
max
<
0
)
throw
new
SQLException
(
TSDBConstants
.
INVALID_VARIABLES
);
// nothing to do
...
...
@@ -163,20 +162,20 @@ public class RestfulStatement implements Statement {
@Override
public
void
setEscapeProcessing
(
boolean
enable
)
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
RestfulStatement
.
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
}
@Override
public
int
getQueryTimeout
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
return
0
;
}
@Override
public
void
setQueryTimeout
(
int
seconds
)
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
if
(
seconds
<
0
)
throw
new
SQLException
(
TSDBConstants
.
INVALID_VARIABLES
);
}
...
...
@@ -189,7 +188,7 @@ public class RestfulStatement implements Statement {
@Override
public
SQLWarning
getWarnings
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
return
null
;
}
...
...
@@ -197,13 +196,13 @@ public class RestfulStatement implements Statement {
public
void
clearWarnings
()
throws
SQLException
{
// nothing to do
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
}
@Override
public
void
setCursorName
(
String
name
)
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
RestfulStatement
.
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
...
...
@@ -243,7 +242,7 @@ public class RestfulStatement implements Statement {
@Override
public
ResultSet
getResultSet
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
return
resultSet
;
}
...
...
@@ -275,7 +274,7 @@ public class RestfulStatement implements Statement {
@Override
public
void
setFetchSize
(
int
rows
)
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
if
(
rows
<
0
)
throw
new
SQLException
(
TSDBConstants
.
INVALID_VARIABLES
);
//nothing to do
...
...
@@ -284,28 +283,28 @@ public class RestfulStatement implements Statement {
@Override
public
int
getFetchSize
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
return
0
;
}
@Override
public
int
getResultSetConcurrency
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
return
this
.
resultSet
.
getConcurrency
();
}
@Override
public
int
getResultSetType
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
return
this
.
resultSet
.
getType
();
}
@Override
public
void
addBatch
(
String
sql
)
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
//TODO:
}
...
...
@@ -323,14 +322,14 @@ public class RestfulStatement implements Statement {
@Override
public
Connection
getConnection
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
return
this
.
conn
;
}
@Override
public
boolean
getMoreResults
(
int
current
)
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
if
(
resultSet
==
null
)
return
false
;
...
...
@@ -388,7 +387,7 @@ public class RestfulStatement implements Statement {
@Override
public
int
getResultSetHoldability
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
return
this
.
resultSet
.
getHoldability
();
}
...
...
@@ -400,28 +399,28 @@ public class RestfulStatement implements Statement {
@Override
public
void
setPoolable
(
boolean
poolable
)
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
//nothing to do
}
@Override
public
boolean
isPoolable
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
return
false
;
}
@Override
public
void
closeOnCompletion
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
this
.
closeOnCompletion
=
true
;
}
@Override
public
boolean
isCloseOnCompletion
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
STATEMENT_CLOSED
);
throw
new
SQLException
(
TSDBConstants
.
STATEMENT_CLOSED
);
return
this
.
closeOnCompletion
;
}
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/StatementTest.java
浏览文件 @
b9da747d
...
...
@@ -66,7 +66,7 @@ public class StatementTest {
assertEquals
(
false
,
isClosed
);
}
@Test
(
expected
=
SQL
FeatureNotSupported
Exception
.
class
)
@Test
(
expected
=
SQLException
.
class
)
public
void
testUnsupport
()
{
try
{
Assert
.
assertNotNull
(
statement
.
unwrap
(
TSDBStatement
.
class
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录