Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mr、小李
TDengine
提交
7c04c9b3
T
TDengine
项目概览
Mr、小李
/
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,发现更多精彩内容 >>
提交
7c04c9b3
编写于
10月 13, 2020
作者:
F
freemine
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. bugFix: nchar/binary field bytes
2. report error for parameterised-select
上级
941c80f3
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
202 addition
and
121 deletion
+202
-121
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+33
-14
src/connector/odbc/src/todbc.c
src/connector/odbc/src/todbc.c
+129
-103
src/connector/odbc/src/todbc_util.h
src/connector/odbc/src/todbc_util.h
+9
-0
src/connector/odbc/tests/odbc.py
src/connector/odbc/tests/odbc.py
+29
-4
src/inc/taos.h
src/inc/taos.h
+1
-0
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
未找到文件。
src/client/src/tscPrepare.c
浏览文件 @
7c04c9b3
...
@@ -638,7 +638,7 @@ TAOS_RES *taos_stmt_use_result(TAOS_STMT* stmt) {
...
@@ -638,7 +638,7 @@ TAOS_RES *taos_stmt_use_result(TAOS_STMT* stmt) {
return
result
;
return
result
;
}
}
int
taos_stmt_
num_params
(
TAOS_STMT
*
stmt
,
int
*
nums
)
{
int
taos_stmt_
is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
if
(
stmt
==
NULL
||
pStmt
->
taos
==
NULL
||
pStmt
->
pSql
==
NULL
)
{
if
(
stmt
==
NULL
||
pStmt
->
taos
==
NULL
||
pStmt
->
pSql
==
NULL
)
{
...
@@ -646,14 +646,29 @@ int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) {
...
@@ -646,14 +646,29 @@ int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) {
return
TSDB_CODE_TSC_DISCONNECTED
;
return
TSDB_CODE_TSC_DISCONNECTED
;
}
}
SSqlObj
*
pSql
=
pStmt
->
pSql
;
if
(
insert
)
*
insert
=
pStmt
->
isInsert
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
*
nums
=
pCmd
->
numOfParams
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int
taos_stmt_num_params
(
TAOS_STMT
*
stmt
,
int
*
nums
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
if
(
stmt
==
NULL
||
pStmt
->
taos
==
NULL
||
pStmt
->
pSql
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_DISCONNECTED
;
return
TSDB_CODE_TSC_DISCONNECTED
;
}
if
(
pStmt
->
isInsert
)
{
SSqlObj
*
pSql
=
pStmt
->
pSql
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
*
nums
=
pCmd
->
numOfParams
;
return
TSDB_CODE_SUCCESS
;
}
else
{
return
TSDB_CODE_TSC_APP_ERROR
;
}
}
int
taos_stmt_get_param
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
)
{
int
taos_stmt_get_param
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
...
@@ -662,18 +677,22 @@ int taos_stmt_get_param(TAOS_STMT *stmt, int idx, int *type, int *bytes) {
...
@@ -662,18 +677,22 @@ int taos_stmt_get_param(TAOS_STMT *stmt, int idx, int *type, int *bytes) {
return
TSDB_CODE_TSC_DISCONNECTED
;
return
TSDB_CODE_TSC_DISCONNECTED
;
}
}
SSqlObj
*
pSql
=
pStmt
->
pSql
;
if
(
pStmt
->
isInsert
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlObj
*
pSql
=
pStmt
->
pSql
;
STableDataBlocks
*
pBlock
=
taosArrayGetP
(
pCmd
->
pDataBlocks
,
0
);
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
STableDataBlocks
*
pBlock
=
taosArrayGetP
(
pCmd
->
pDataBlocks
,
0
);
assert
(
pCmd
->
numOfParams
==
pBlock
->
numOfParams
);
assert
(
pCmd
->
numOfParams
==
pBlock
->
numOfParams
);
if
(
idx
<
0
||
idx
>=
pBlock
->
numOfParams
)
return
-
1
;
if
(
idx
<
0
||
idx
>=
pBlock
->
numOfParams
)
return
-
1
;
SParamInfo
*
param
=
pBlock
->
params
+
idx
;
SParamInfo
*
param
=
pBlock
->
params
+
idx
;
if
(
type
)
*
type
=
param
->
type
;
if
(
type
)
*
type
=
param
->
type
;
if
(
bytes
)
*
bytes
=
param
->
bytes
;
if
(
bytes
)
*
bytes
=
param
->
bytes
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
{
return
TSDB_CODE_TSC_APP_ERROR
;
}
}
}
const
char
*
taos_data_type
(
int
type
)
{
const
char
*
taos_data_type
(
int
type
)
{
...
...
src/connector/odbc/src/todbc.c
浏览文件 @
7c04c9b3
此差异已折叠。
点击以展开。
src/connector/odbc/src/todbc_util.h
浏览文件 @
7c04c9b3
...
@@ -35,6 +35,15 @@ do { \
...
@@ -35,6 +35,15 @@ do { \
abort(); \
abort(); \
} while (0)
} while (0)
#define DASSERTX(statement, fmt, ...) \
do { \
if (statement) break; \
D("Assertion failure: %s, " fmt "", #statement, ##__VA_ARGS__); \
abort(); \
} while (0)
const
char
*
sql_sql_type
(
int
type
);
const
char
*
sql_sql_type
(
int
type
);
const
char
*
sql_c_type
(
int
type
);
const
char
*
sql_c_type
(
int
type
);
...
...
src/connector/odbc/tests/odbc.py
浏览文件 @
7c04c9b3
...
@@ -3,10 +3,11 @@ cnxn = pyodbc.connect('DSN=TAOS_DSN;UID=root;PWD=taosdata', autocommit=True)
...
@@ -3,10 +3,11 @@ cnxn = pyodbc.connect('DSN=TAOS_DSN;UID=root;PWD=taosdata', autocommit=True)
cnxn
.
setdecoding
(
pyodbc
.
SQL_CHAR
,
encoding
=
'utf-8'
)
cnxn
.
setdecoding
(
pyodbc
.
SQL_CHAR
,
encoding
=
'utf-8'
)
#cnxn.setdecoding(pyodbc.SQL_WCHAR, encoding='utf-8')
#cnxn.setdecoding(pyodbc.SQL_WCHAR, encoding='utf-8')
#cnxn.setencoding(encoding='utf-8')
#cnxn.setencoding(encoding='utf-8')
cursor
=
cnxn
.
cursor
()
cursor
=
cnxn
.
cursor
()
cursor
.
execute
(
"SELECT * from db.t"
)
cursor
.
execute
(
"SELECT * from db.t"
)
row
=
cursor
.
fetchone
()
row
=
cursor
.
fetchone
()
while
row
:
while
row
:
print
(
row
)
print
(
row
)
row
=
cursor
.
fetchone
()
row
=
cursor
.
fetchone
()
cursor
.
close
()
cursor
.
close
()
...
@@ -48,8 +49,32 @@ cursor.close()
...
@@ -48,8 +49,32 @@ cursor.close()
cursor
=
cnxn
.
cursor
()
cursor
=
cnxn
.
cursor
()
cursor
.
execute
(
"SELECT * from db.t"
)
cursor
.
execute
(
"SELECT * from db.t"
)
row
=
cursor
.
fetchone
()
row
=
cursor
.
fetchone
()
while
row
:
while
row
:
print
(
row
)
row
=
cursor
.
fetchone
()
cursor
.
close
()
cursor
=
cnxn
.
cursor
()
cursor
.
execute
(
"drop database if exists db"
);
cursor
.
close
()
cursor
=
cnxn
.
cursor
()
cursor
.
execute
(
"create database db"
);
cursor
.
close
()
cursor
=
cnxn
.
cursor
()
cursor
.
execute
(
"create table db.t (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin binary(4), blob nchar(4))"
);
cursor
.
close
()
cursor
=
cnxn
.
cursor
()
cursor
.
execute
(
"insert into db.t values('2020-10-13 06:44:00', 1, 127, 32767, 32768, 32769, 123.456, 789.987, 'hell', 'worl')"
)
cursor
.
close
()
cursor
=
cnxn
.
cursor
()
cursor
.
execute
(
"SELECT * from db.t"
)
row
=
cursor
.
fetchone
()
while
row
:
print
(
row
)
print
(
row
)
row
=
cursor
.
fetchone
()
row
=
cursor
.
fetchone
()
cursor
.
close
()
cursor
.
close
()
...
...
src/inc/taos.h
浏览文件 @
7c04c9b3
...
@@ -96,6 +96,7 @@ typedef struct TAOS_BIND {
...
@@ -96,6 +96,7 @@ typedef struct TAOS_BIND {
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
);
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
);
int
taos_stmt_prepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
int
taos_stmt_prepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
int
taos_stmt_num_params
(
TAOS_STMT
*
stmt
,
int
*
nums
);
int
taos_stmt_num_params
(
TAOS_STMT
*
stmt
,
int
*
nums
);
int
taos_stmt_get_param
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
);
int
taos_stmt_get_param
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
);
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
);
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
);
...
...
src/inc/taoserror.h
浏览文件 @
7c04c9b3
...
@@ -366,6 +366,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_INVALID_CURSOR, 0, 0x2110, "invalid cu
...
@@ -366,6 +366,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_INVALID_CURSOR, 0, 0x2110, "invalid cu
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_STATEMENT_NOT_READY
,
0
,
0x2111
,
"statement not ready"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_STATEMENT_NOT_READY
,
0
,
0x2111
,
"statement not ready"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_CONNECTION_BUSY
,
0
,
0x2112
,
"connection still busy"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_CONNECTION_BUSY
,
0
,
0x2112
,
"connection still busy"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_BAD_CONNSTR
,
0
,
0x2113
,
"bad connection string"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_BAD_CONNSTR
,
0
,
0x2113
,
"bad connection string"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_BAD_ARG
,
0
,
0x2114
,
"bad argument"
)
#ifdef TAOS_ERROR_C
#ifdef TAOS_ERROR_C
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录