Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
54143e06
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看板
提交
54143e06
编写于
9月 11, 2020
作者:
Z
zyyang-taosdata
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement the TSDBStatement.getConnection function
上级
8c677755
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
248 addition
and
234 deletion
+248
-234
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBConnection.java
.../jdbc/src/main/java/com/taosdata/jdbc/TSDBConnection.java
+16
-14
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBPreparedStatement.java
...rc/main/java/com/taosdata/jdbc/TSDBPreparedStatement.java
+2
-2
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
...r/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
+230
-217
tests/examples/JDBC/SpringJdbcTemplate/src/test/java/com/taosdata/jdbc/example/jdbcTemplate/BatcherInsertTest.java
...taosdata/jdbc/example/jdbcTemplate/BatcherInsertTest.java
+0
-1
未找到文件。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBConnection.java
浏览文件 @
54143e06
...
...
@@ -57,9 +57,9 @@ public class TSDBConnection implements Connection {
File
cfgDir
=
loadConfigDir
(
info
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_CONFIG_DIR
));
File
cfgFile
=
cfgDir
.
listFiles
((
dir
,
name
)
->
"taos.cfg"
.
equalsIgnoreCase
(
name
))[
0
];
List
<
String
>
endpoints
=
loadConfigEndpoints
(
cfgFile
);
if
(!
endpoints
.
isEmpty
()){
info
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_HOST
,
endpoints
.
get
(
0
).
split
(
":"
)[
0
]);
info
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_PORT
,
endpoints
.
get
(
0
).
split
(
":"
)[
1
]);
if
(!
endpoints
.
isEmpty
())
{
info
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_HOST
,
endpoints
.
get
(
0
).
split
(
":"
)[
0
]);
info
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_PORT
,
endpoints
.
get
(
0
).
split
(
":"
)[
1
]);
}
//load taos.cfg end
...
...
@@ -69,15 +69,15 @@ public class TSDBConnection implements Connection {
info
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
));
}
private
List
<
String
>
loadConfigEndpoints
(
File
cfgFile
){
private
List
<
String
>
loadConfigEndpoints
(
File
cfgFile
)
{
List
<
String
>
endpoints
=
new
ArrayList
<>();
try
(
BufferedReader
reader
=
new
BufferedReader
(
new
FileReader
(
cfgFile
)))
{
try
(
BufferedReader
reader
=
new
BufferedReader
(
new
FileReader
(
cfgFile
)))
{
String
line
=
null
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
if
(
line
.
trim
().
startsWith
(
"firstEp"
)
||
line
.
trim
().
startsWith
(
"secondEp"
)){
endpoints
.
add
(
line
.
substring
(
line
.
indexOf
(
'p'
)
+
1
).
trim
());
while
((
line
=
reader
.
readLine
())
!=
null
)
{
if
(
line
.
trim
().
startsWith
(
"firstEp"
)
||
line
.
trim
().
startsWith
(
"secondEp"
))
{
endpoints
.
add
(
line
.
substring
(
line
.
indexOf
(
'p'
)
+
1
).
trim
());
}
if
(
endpoints
.
size
()
>
1
)
if
(
endpoints
.
size
()
>
1
)
break
;
}
}
catch
(
FileNotFoundException
e
)
{
...
...
@@ -91,7 +91,7 @@ public class TSDBConnection implements Connection {
/**
* @param cfgDirPath
* @return return the config dir
*
*
*/
**/
private
File
loadConfigDir
(
String
cfgDirPath
)
{
if
(
cfgDirPath
==
null
)
return
loadDefaultConfigDir
();
...
...
@@ -103,8 +103,8 @@ public class TSDBConnection implements Connection {
/**
* @return search the default config dir, if the config dir is not exist will return null
*
*
/
private
File
loadDefaultConfigDir
(){
*/
private
File
loadDefaultConfigDir
()
{
File
cfgDir
;
File
cfgDir_linux
=
new
File
(
"/etc/taos"
);
cfgDir
=
cfgDir_linux
.
exists
()
?
cfgDir_linux
:
null
;
...
...
@@ -132,7 +132,9 @@ public class TSDBConnection implements Connection {
public
Statement
createStatement
()
throws
SQLException
{
if
(!
this
.
connector
.
isClosed
())
{
return
new
TSDBStatement
(
this
.
connector
);
TSDBStatement
statement
=
new
TSDBStatement
(
this
,
this
.
connector
);
statement
.
setConnection
(
this
);
return
statement
;
}
else
{
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
));
}
...
...
@@ -153,7 +155,7 @@ public class TSDBConnection implements Connection {
public
PreparedStatement
prepareStatement
(
String
sql
)
throws
SQLException
{
if
(!
this
.
connector
.
isClosed
())
{
return
new
TSDBPreparedStatement
(
this
.
connector
,
sql
);
return
new
TSDBPreparedStatement
(
this
,
this
.
connector
,
sql
);
}
else
{
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
));
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBPreparedStatement.java
浏览文件 @
54143e06
...
...
@@ -42,8 +42,8 @@ public class TSDBPreparedStatement extends TSDBStatement implements PreparedStat
private
SavedPreparedStatement
savedPreparedStatement
;
TSDBPreparedStatement
(
TSDBJNIConnector
connecter
,
String
sql
)
{
super
(
connecter
);
TSDBPreparedStatement
(
TSDB
Connection
connection
,
TSDB
JNIConnector
connecter
,
String
sql
)
{
super
(
connect
ion
,
connect
er
);
init
(
sql
);
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
浏览文件 @
54143e06
...
...
@@ -19,153 +19,164 @@ import java.util.ArrayList;
import
java.util.List
;
public
class
TSDBStatement
implements
Statement
{
private
TSDBJNIConnector
connecter
=
null
;
private
TSDBJNIConnector
connecter
=
null
;
/** To store batched commands */
protected
List
<
String
>
batchedArgs
;
/**
* To store batched commands
*/
protected
List
<
String
>
batchedArgs
;
/** Timeout for a query */
protected
int
queryTimeout
=
0
;
/**
* Timeout for a query
*/
protected
int
queryTimeout
=
0
;
private
Long
pSql
=
0
l
;
private
Long
pSql
=
0
l
;
/**
* Status of current statement
*/
private
boolean
isClosed
=
true
;
private
int
affectedRows
=
0
;
private
boolean
isClosed
=
true
;
private
int
affectedRows
=
0
;
TSDBStatement
(
TSDBJNIConnector
connecter
)
{
this
.
connecter
=
connecter
;
this
.
isClosed
=
false
;
}
private
TSDBConnection
connection
;
public
<
T
>
T
unwrap
(
Class
<
T
>
iface
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
)
;
}
public
void
setConnection
(
TSDBConnection
connection
)
{
this
.
connection
=
connection
;
}
public
boolean
isWrapperFor
(
Class
<?>
iface
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
TSDBStatement
(
TSDBConnection
connection
,
TSDBJNIConnector
connecter
)
{
this
.
connection
=
connection
;
this
.
connecter
=
connecter
;
this
.
isClosed
=
false
;
}
public
ResultSet
executeQuery
(
String
sql
)
throws
SQLException
{
public
<
T
>
T
unwrap
(
Class
<
T
>
iface
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
isWrapperFor
(
Class
<?>
iface
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
ResultSet
executeQuery
(
String
sql
)
throws
SQLException
{
if
(
isClosed
)
{
throw
new
SQLException
(
"Invalid method call on a closed statement."
);
}
// TODO make sure it is not a update query
pSql
=
this
.
connecter
.
executeQuery
(
sql
);
pSql
=
this
.
connecter
.
executeQuery
(
sql
);
long
resultSetPointer
=
this
.
connecter
.
getResultSet
();
long
resultSetPointer
=
this
.
connecter
.
getResultSet
();
if
(
resultSetPointer
==
TSDBConstants
.
JNI_CONNECTION_NULL
)
{
this
.
connecter
.
freeResultSet
(
pSql
);
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
));
}
if
(
resultSetPointer
==
TSDBConstants
.
JNI_CONNECTION_NULL
)
{
this
.
connecter
.
freeResultSet
(
pSql
);
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
));
}
// create/insert/update/delete/alter
if
(
resultSetPointer
==
TSDBConstants
.
JNI_NULL_POINTER
)
{
this
.
connecter
.
freeResultSet
(
pSql
);
return
null
;
}
if
(
resultSetPointer
==
TSDBConstants
.
JNI_NULL_POINTER
)
{
this
.
connecter
.
freeResultSet
(
pSql
);
return
null
;
}
if
(!
this
.
connecter
.
isUpdateQuery
(
pSql
))
{
return
new
TSDBResultSet
(
this
.
connecter
,
resultSetPointer
);
}
else
{
this
.
connecter
.
freeResultSet
(
pSql
);
return
null
;
}
if
(!
this
.
connecter
.
isUpdateQuery
(
pSql
))
{
return
new
TSDBResultSet
(
this
.
connecter
,
resultSetPointer
);
}
else
{
this
.
connecter
.
freeResultSet
(
pSql
);
return
null
;
}
}
}
public
int
executeUpdate
(
String
sql
)
throws
SQLException
{
public
int
executeUpdate
(
String
sql
)
throws
SQLException
{
if
(
isClosed
)
{
throw
new
SQLException
(
"Invalid method call on a closed statement."
);
}
// TODO check if current query is update query
pSql
=
this
.
connecter
.
executeQuery
(
sql
);
long
resultSetPointer
=
this
.
connecter
.
getResultSet
();
pSql
=
this
.
connecter
.
executeQuery
(
sql
);
long
resultSetPointer
=
this
.
connecter
.
getResultSet
();
if
(
resultSetPointer
==
TSDBConstants
.
JNI_CONNECTION_NULL
)
{
this
.
connecter
.
freeResultSet
(
pSql
);
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
));
}
if
(
resultSetPointer
==
TSDBConstants
.
JNI_CONNECTION_NULL
)
{
this
.
connecter
.
freeResultSet
(
pSql
);
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
));
}
this
.
affectedRows
=
this
.
connecter
.
getAffectedRows
(
pSql
);
this
.
connecter
.
freeResultSet
(
pSql
);
this
.
affectedRows
=
this
.
connecter
.
getAffectedRows
(
pSql
);
this
.
connecter
.
freeResultSet
(
pSql
);
return
this
.
affectedRows
;
}
return
this
.
affectedRows
;
}
public
String
getErrorMsg
(
long
pSql
)
{
return
this
.
connecter
.
getErrMsg
(
pSql
);
}
public
String
getErrorMsg
(
long
pSql
)
{
return
this
.
connecter
.
getErrMsg
(
pSql
);
}
public
void
close
()
throws
SQLException
{
public
void
close
()
throws
SQLException
{
if
(!
isClosed
)
{
if
(!
this
.
connecter
.
isResultsetClosed
())
{
this
.
connecter
.
freeResultSet
();
}
isClosed
=
true
;
}
}
}
public
int
getMaxFieldSize
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
getMaxFieldSize
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
setMaxFieldSize
(
int
max
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
setMaxFieldSize
(
int
max
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
getMaxRows
()
throws
SQLException
{
// always set maxRows to zero, meaning unlimitted rows in a resultSet
return
0
;
}
public
int
getMaxRows
()
throws
SQLException
{
// always set maxRows to zero, meaning unlimitted rows in a resultSet
return
0
;
}
public
void
setMaxRows
(
int
max
)
throws
SQLException
{
// always set maxRows to zero, meaning unlimitted rows in a resultSet
}
public
void
setMaxRows
(
int
max
)
throws
SQLException
{
// always set maxRows to zero, meaning unlimitted rows in a resultSet
}
public
void
setEscapeProcessing
(
boolean
enable
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
setEscapeProcessing
(
boolean
enable
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
getQueryTimeout
()
throws
SQLException
{
return
queryTimeout
;
}
public
int
getQueryTimeout
()
throws
SQLException
{
return
queryTimeout
;
}
public
void
setQueryTimeout
(
int
seconds
)
throws
SQLException
{
this
.
queryTimeout
=
seconds
;
}
public
void
setQueryTimeout
(
int
seconds
)
throws
SQLException
{
this
.
queryTimeout
=
seconds
;
}
public
void
cancel
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
cancel
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
SQLWarning
getWarnings
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
SQLWarning
getWarnings
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
clearWarnings
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
clearWarnings
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
setCursorName
(
String
name
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
setCursorName
(
String
name
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
execute
(
String
sql
)
throws
SQLException
{
public
boolean
execute
(
String
sql
)
throws
SQLException
{
if
(
isClosed
)
{
throw
new
SQLException
(
"Invalid method call on a closed statement."
);
}
boolean
res
=
true
;
pSql
=
this
.
connecter
.
executeQuery
(
sql
);
long
resultSetPointer
=
this
.
connecter
.
getResultSet
();
boolean
res
=
true
;
pSql
=
this
.
connecter
.
executeQuery
(
sql
);
long
resultSetPointer
=
this
.
connecter
.
getResultSet
();
if
(
resultSetPointer
==
TSDBConstants
.
JNI_CONNECTION_NULL
)
{
this
.
connecter
.
freeResultSet
(
pSql
);
this
.
connecter
.
freeResultSet
(
pSql
);
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
));
}
else
if
(
resultSetPointer
==
TSDBConstants
.
JNI_NULL_POINTER
)
{
// no result set is retrieved
...
...
@@ -173,145 +184,147 @@ public class TSDBStatement implements Statement {
res
=
false
;
}
return
res
;
}
return
res
;
}
public
ResultSet
getResultSet
()
throws
SQLException
{
public
ResultSet
getResultSet
()
throws
SQLException
{
if
(
isClosed
)
{
throw
new
SQLException
(
"Invalid method call on a closed statement."
);
}
long
resultSetPointer
=
connecter
.
getResultSet
();
TSDBResultSet
resSet
=
null
;
long
resultSetPointer
=
connecter
.
getResultSet
();
TSDBResultSet
resSet
=
null
;
if
(
resultSetPointer
!=
TSDBConstants
.
JNI_NULL_POINTER
)
{
resSet
=
new
TSDBResultSet
(
connecter
,
resultSetPointer
);
}
return
resSet
;
}
return
resSet
;
}
public
int
getUpdateCount
()
throws
SQLException
{
public
int
getUpdateCount
()
throws
SQLException
{
if
(
isClosed
)
{
throw
new
SQLException
(
"Invalid method call on a closed statement."
);
}
return
this
.
affectedRows
;
}
public
boolean
getMoreResults
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
setFetchDirection
(
int
direction
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
getFetchDirection
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
/*
* used by spark
*/
public
void
setFetchSize
(
int
rows
)
throws
SQLException
{
}
/*
* used by spark
*/
public
int
getFetchSize
()
throws
SQLException
{
return
4096
;
}
public
int
getResultSetConcurrency
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
getResultSetType
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
addBatch
(
String
sql
)
throws
SQLException
{
if
(
batchedArgs
==
null
)
{
batchedArgs
=
new
ArrayList
<
String
>();
}
batchedArgs
.
add
(
sql
);
}
public
void
clearBatch
()
throws
SQLException
{
batchedArgs
.
clear
();
}
public
int
[]
executeBatch
()
throws
SQLException
{
return
this
.
affectedRows
;
}
public
boolean
getMoreResults
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
setFetchDirection
(
int
direction
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
getFetchDirection
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
/*
* used by spark
*/
public
void
setFetchSize
(
int
rows
)
throws
SQLException
{
}
/*
* used by spark
*/
public
int
getFetchSize
()
throws
SQLException
{
return
4096
;
}
public
int
getResultSetConcurrency
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
getResultSetType
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
addBatch
(
String
sql
)
throws
SQLException
{
if
(
batchedArgs
==
null
)
{
batchedArgs
=
new
ArrayList
<
String
>();
}
batchedArgs
.
add
(
sql
);
}
public
void
clearBatch
()
throws
SQLException
{
batchedArgs
.
clear
();
}
public
int
[]
executeBatch
()
throws
SQLException
{
if
(
isClosed
)
{
throw
new
SQLException
(
"Invalid method call on a closed statement."
);
}
if
(
batchedArgs
==
null
)
{
throw
new
SQLException
(
TSDBConstants
.
WrapErrMsg
(
"Batch is empty!"
));
}
else
{
int
[]
res
=
new
int
[
batchedArgs
.
size
()];
for
(
int
i
=
0
;
i
<
batchedArgs
.
size
();
i
++)
{
res
[
i
]
=
executeUpdate
(
batchedArgs
.
get
(
i
));
}
return
res
;
}
}
public
Connection
getConnection
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
getMoreResults
(
int
current
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
ResultSet
getGeneratedKeys
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
executeUpdate
(
String
sql
,
int
autoGeneratedKeys
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
executeUpdate
(
String
sql
,
int
[]
columnIndexes
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
executeUpdate
(
String
sql
,
String
[]
columnNames
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
execute
(
String
sql
,
int
autoGeneratedKeys
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
execute
(
String
sql
,
int
[]
columnIndexes
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
execute
(
String
sql
,
String
[]
columnNames
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
getResultSetHoldability
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
isClosed
()
throws
SQLException
{
return
isClosed
;
}
public
void
setPoolable
(
boolean
poolable
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
isPoolable
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
closeOnCompletion
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
isCloseOnCompletion
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
if
(
batchedArgs
==
null
)
{
throw
new
SQLException
(
TSDBConstants
.
WrapErrMsg
(
"Batch is empty!"
));
}
else
{
int
[]
res
=
new
int
[
batchedArgs
.
size
()];
for
(
int
i
=
0
;
i
<
batchedArgs
.
size
();
i
++)
{
res
[
i
]
=
executeUpdate
(
batchedArgs
.
get
(
i
));
}
return
res
;
}
}
public
Connection
getConnection
()
throws
SQLException
{
if
(
this
.
connecter
!=
null
)
return
this
.
connection
;
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
getMoreResults
(
int
current
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
ResultSet
getGeneratedKeys
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
executeUpdate
(
String
sql
,
int
autoGeneratedKeys
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
executeUpdate
(
String
sql
,
int
[]
columnIndexes
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
executeUpdate
(
String
sql
,
String
[]
columnNames
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
execute
(
String
sql
,
int
autoGeneratedKeys
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
execute
(
String
sql
,
int
[]
columnIndexes
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
execute
(
String
sql
,
String
[]
columnNames
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
int
getResultSetHoldability
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
isClosed
()
throws
SQLException
{
return
isClosed
;
}
public
void
setPoolable
(
boolean
poolable
)
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
isPoolable
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
void
closeOnCompletion
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
public
boolean
isCloseOnCompletion
()
throws
SQLException
{
throw
new
SQLException
(
TSDBConstants
.
UNSUPPORT_METHOD_EXCEPTIONZ_MSG
);
}
}
tests/examples/JDBC/SpringJdbcTemplate/src/test/java/com/taosdata/jdbc/example/jdbcTemplate/BatcherInsertTest.java
浏览文件 @
54143e06
...
...
@@ -61,5 +61,4 @@ public class BatcherInsertTest {
assertEquals
(
count
,
numOfRecordsPerTable
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录