Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yiicenne
TDengine
提交
420a8343
TDengine
项目概览
yiicenne
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
420a8343
编写于
5月 10, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-4038]refactor
上级
f02fd80a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
11 deletion
+31
-11
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+7
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java
...dbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java
+20
-8
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBPreparedStatement.java
...rc/main/java/com/taosdata/jdbc/TSDBPreparedStatement.java
+4
-3
未找到文件。
src/client/src/TSDBJNIConnector.c
浏览文件 @
420a8343
...
...
@@ -742,6 +742,8 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setBindTableNameI
int32_t
code
=
taos_stmt_set_tbname
((
void
*
)
stmt
,
name
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jname
,
name
);
jniError
(
"jobj:%p, conn:%p, code:%s"
,
jobj
,
tsconn
,
tstrerror
(
code
));
return
JNI_TDENGINE_ERROR
;
}
...
...
@@ -817,6 +819,11 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_bindColDataImp(J
}
int32_t
code
=
taos_stmt_bind_single_param_batch
(
pStmt
,
b
,
colIndex
);
tfree
(
b
->
length
);
tfree
(
b
->
buffer
);
tfree
(
b
->
is_null
);
tfree
(
b
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
jniError
(
"jobj:%p, conn:%p, code:%s"
,
jobj
,
tscon
,
tstrerror
(
code
));
return
JNI_TDENGINE_ERROR
;
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java
浏览文件 @
420a8343
...
...
@@ -300,26 +300,38 @@ public class TSDBJNIConnector {
private
native
long
prepareStmtImp
(
byte
[]
sql
,
long
con
);
public
int
setBindTableName
(
long
stmt
,
String
tableName
)
{
return
setBindTableNameImp
(
stmt
,
tableName
,
this
.
taos
);
public
void
setBindTableName
(
long
stmt
,
String
tableName
)
throws
SQLException
{
int
code
=
setBindTableNameImp
(
stmt
,
tableName
,
this
.
taos
);
if
(
code
!=
TSDBConstants
.
JNI_SUCCESS
)
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_UNKNOWN
,
"failed to set table name"
);
}
}
private
native
int
setBindTableNameImp
(
long
stmt
,
String
name
,
long
conn
);
public
int
bindColumnDataArray
(
long
stmt
,
ByteBuffer
colDataList
,
ByteBuffer
lengthList
,
ByteBuffer
isNullList
,
int
type
,
int
bytes
,
int
numOfRows
,
int
columnIndex
)
{
return
bindColDataImp
(
stmt
,
colDataList
.
array
(),
lengthList
.
array
(),
isNullList
.
array
(),
type
,
bytes
,
numOfRows
,
columnIndex
,
this
.
taos
);
public
void
bindColumnDataArray
(
long
stmt
,
ByteBuffer
colDataList
,
ByteBuffer
lengthList
,
ByteBuffer
isNullList
,
int
type
,
int
bytes
,
int
numOfRows
,
int
columnIndex
)
throws
SQLException
{
int
code
=
bindColDataImp
(
stmt
,
colDataList
.
array
(),
lengthList
.
array
(),
isNullList
.
array
(),
type
,
bytes
,
numOfRows
,
columnIndex
,
this
.
taos
);
if
(
code
!=
TSDBConstants
.
JNI_SUCCESS
)
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_UNKNOWN
,
"failed to bind column data"
);
}
}
private
native
int
bindColDataImp
(
long
stmt
,
byte
[]
colDataList
,
byte
[]
lengthList
,
byte
[]
isNullList
,
int
type
,
int
bytes
,
int
numOfRows
,
int
columnIndex
,
long
conn
);
public
int
executeBatch
(
long
stmt
)
{
return
executeBatchImp
(
stmt
,
this
.
taos
);
public
void
executeBatch
(
long
stmt
)
throws
SQLException
{
int
code
=
executeBatchImp
(
stmt
,
this
.
taos
);
if
(
code
!=
TSDBConstants
.
JNI_SUCCESS
)
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_UNKNOWN
,
"failed to execute batch bind"
);
}
}
private
native
int
executeBatchImp
(
long
stmt
,
long
con
);
public
int
closeBatch
(
long
stmt
)
{
return
closeStmt
(
stmt
,
this
.
taos
);
public
void
closeBatch
(
long
stmt
)
throws
SQLException
{
int
code
=
closeStmt
(
stmt
,
this
.
taos
);
if
(
code
!=
TSDBConstants
.
JNI_SUCCESS
)
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_UNKNOWN
,
"failed to close batch bind"
);
}
}
private
native
int
closeStmt
(
long
stmt
,
long
con
);
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBPreparedStatement.java
浏览文件 @
420a8343
...
...
@@ -733,9 +733,6 @@ public class TSDBPreparedStatement extends TSDBStatement implements PreparedStat
String
charset
=
TaosGlobalConfig
.
getCharset
();
for
(
int
j
=
0
;
j
<
rows
;
++
j
)
{
String
val
=
(
String
)
col1
.
data
.
get
(
j
);
if
(
val
!=
null
&&
val
.
length
()
>
col1
.
bytes
)
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_UNKNOWN
,
"string data too long"
);
}
colDataList
.
position
(
j
*
col1
.
bytes
);
// seek to the correct position
if
(
val
!=
null
)
{
...
...
@@ -750,6 +747,10 @@ public class TSDBPreparedStatement extends TSDBStatement implements PreparedStat
e
.
printStackTrace
();
}
if
(
val
.
length
()
>
col1
.
bytes
)
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_UNKNOWN
,
"string data too long"
);
}
colDataList
.
put
(
b
);
lengthList
.
putInt
(
b
.
length
);
isNullList
.
put
((
byte
)
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录