Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a823535f
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a823535f
编写于
4月 13, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stmt
上级
36244066
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
91 addition
and
24 deletion
+91
-24
source/client/inc/clientStmt.h
source/client/inc/clientStmt.h
+24
-9
source/client/src/clientMain.c
source/client/src/clientMain.c
+16
-15
source/client/src/clientStmt.c
source/client/src/clientStmt.c
+51
-0
未找到文件。
source/client/inc/clientStmt.h
浏览文件 @
a823535f
...
@@ -28,18 +28,33 @@ typedef enum {
...
@@ -28,18 +28,33 @@ typedef enum {
typedef
struct
STscStmt
{
typedef
struct
STscStmt
{
STMT_TYPE
type
;
STMT_TYPE
type
;
int16_t
last
;
//
int16_t last;
STscObj
*
taos
;
//
STscObj* taos;
SSqlObj
*
pSql
;
//
SSqlObj* pSql;
SMultiTbStmt
mtb
;
//
SMultiTbStmt mtb;
SNormalStmt
normal
;
//
SNormalStmt normal;
int
numOfRows
;
//
int numOfRows;
}
STscStmt
;
}
STscStmt
;
#define SCH_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
#define STMT_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
#define SCH_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
#define STMT_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
#define SCH_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
#define STMT_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
TAOS_STMT
*
stmtInit
(
TAOS
*
taos
);
int
stmtClose
(
TAOS_STMT
*
stmt
);
int
stmtExec
(
TAOS_STMT
*
stmt
);
char
*
stmtErrstr
(
TAOS_STMT
*
stmt
);
int
stmtAffectedRows
(
TAOS_STMT
*
stmt
);
int
stmtBind
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
);
int
stmtPrepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
int
stmtSetTbNameTags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
);
int
stmtIsInsert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
int
stmtGetParamNum
(
TAOS_STMT
*
stmt
,
int
*
nums
);
int
stmtAddBatch
(
TAOS_STMT
*
stmt
);
TAOS_RES
*
stmtUseResult
(
TAOS_STMT
*
stmt
);
int
stmtBindBatch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/client/src/clientMain.c
浏览文件 @
a823535f
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include "catalog.h"
#include "catalog.h"
#include "scheduler.h"
#include "scheduler.h"
#include "clientInt.h"
#include "clientInt.h"
#include "clientStmt.h"
#include "clientLog.h"
#include "clientLog.h"
#include "os.h"
#include "os.h"
#include "query.h"
#include "query.h"
...
@@ -560,7 +561,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
...
@@ -560,7 +561,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
)
{
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
)
{
if
(
taos
==
NULL
)
{
if
(
taos
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
NULL
;
return
NULL
;
}
}
...
@@ -570,7 +571,7 @@ TAOS_STMT *taos_stmt_init(TAOS *taos) {
...
@@ -570,7 +571,7 @@ TAOS_STMT *taos_stmt_init(TAOS *taos) {
int
taos_stmt_close
(
TAOS_STMT
*
stmt
)
{
int
taos_stmt_close
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
...
@@ -580,7 +581,7 @@ int taos_stmt_close(TAOS_STMT *stmt) {
...
@@ -580,7 +581,7 @@ int taos_stmt_close(TAOS_STMT *stmt) {
int
taos_stmt_execute
(
TAOS_STMT
*
stmt
)
{
int
taos_stmt_execute
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
...
@@ -590,7 +591,7 @@ int taos_stmt_execute(TAOS_STMT *stmt) {
...
@@ -590,7 +591,7 @@ int taos_stmt_execute(TAOS_STMT *stmt) {
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
)
{
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
NULL
;
return
NULL
;
}
}
...
@@ -600,7 +601,7 @@ char *taos_stmt_errstr(TAOS_STMT *stmt) {
...
@@ -600,7 +601,7 @@ char *taos_stmt_errstr(TAOS_STMT *stmt) {
int
taos_stmt_affected_rows
(
TAOS_STMT
*
stmt
)
{
int
taos_stmt_affected_rows
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
0
;
return
0
;
}
}
...
@@ -610,7 +611,7 @@ int taos_stmt_affected_rows(TAOS_STMT *stmt) {
...
@@ -610,7 +611,7 @@ int taos_stmt_affected_rows(TAOS_STMT *stmt) {
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
)
{
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
)
{
if
(
stmt
==
NULL
||
bind
==
NULL
)
{
if
(
stmt
==
NULL
||
bind
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
...
@@ -620,7 +621,7 @@ int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind) {
...
@@ -620,7 +621,7 @@ int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind) {
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
)
{
if
(
stmt
==
NULL
||
sql
==
NULL
)
{
if
(
stmt
==
NULL
||
sql
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
...
@@ -630,7 +631,7 @@ int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length) {
...
@@ -630,7 +631,7 @@ int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length) {
int
taos_stmt_set_tbname_tags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
)
{
int
taos_stmt_set_tbname_tags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
)
{
if
(
stmt
==
NULL
||
name
==
NULL
||
tags
==
NULL
)
{
if
(
stmt
==
NULL
||
name
==
NULL
||
tags
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
...
@@ -640,7 +641,7 @@ int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_BIND *tags
...
@@ -640,7 +641,7 @@ int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_BIND *tags
int
taos_stmt_set_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
)
{
int
taos_stmt_set_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
)
{
if
(
stmt
==
NULL
||
name
==
NULL
)
{
if
(
stmt
==
NULL
||
name
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
...
@@ -650,7 +651,7 @@ int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name) {
...
@@ -650,7 +651,7 @@ int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name) {
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
)
{
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
)
{
if
(
stmt
==
NULL
||
insert
==
NULL
)
{
if
(
stmt
==
NULL
||
insert
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
...
@@ -660,7 +661,7 @@ int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert) {
...
@@ -660,7 +661,7 @@ 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
)
{
if
(
stmt
==
NULL
||
nums
==
NULL
)
{
if
(
stmt
==
NULL
||
nums
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
...
@@ -670,7 +671,7 @@ int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) {
...
@@ -670,7 +671,7 @@ int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) {
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
)
{
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
...
@@ -680,9 +681,9 @@ int taos_stmt_add_batch(TAOS_STMT *stmt) {
...
@@ -680,9 +681,9 @@ int taos_stmt_add_batch(TAOS_STMT *stmt) {
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
)
{
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
NULL
;
}
}
return
stmtUseResult
(
stmt
);
return
stmtUseResult
(
stmt
);
...
@@ -690,7 +691,7 @@ TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt) {
...
@@ -690,7 +691,7 @@ TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt) {
int
taos_stmt_bind_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
)
{
int
taos_stmt_bind_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
)
{
if
(
stmt
==
NULL
||
bind
==
NULL
)
{
if
(
stmt
==
NULL
||
bind
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNC__
);
tscError
(
"NULL parameter for %s"
,
__FUNC
TION
__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
...
...
source/client/src/clientStmt.c
浏览文件 @
a823535f
#include "clientInt.h"
#include "clientInt.h"
#include "clientLog.h"
#include "clientLog.h"
#include "clientStmt.h"
#include "tdef.h"
#include "tdef.h"
TAOS_STMT
*
stmtInit
(
TAOS
*
taos
)
{
TAOS_STMT
*
stmtInit
(
TAOS
*
taos
)
{
...
@@ -46,3 +47,53 @@ TAOS_STMT *stmtInit(TAOS *taos) {
...
@@ -46,3 +47,53 @@ TAOS_STMT *stmtInit(TAOS *taos) {
return
pStmt
;
return
pStmt
;
}
}
int
stmtClose
(
TAOS_STMT
*
stmt
)
{
return
TSDB_CODE_SUCCESS
;
}
int
stmtExec
(
TAOS_STMT
*
stmt
)
{
return
TSDB_CODE_SUCCESS
;
}
char
*
stmtErrstr
(
TAOS_STMT
*
stmt
)
{
return
NULL
;
}
int
stmtAffectedRows
(
TAOS_STMT
*
stmt
)
{
return
TSDB_CODE_SUCCESS
;
}
int
stmtBind
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
)
{
return
TSDB_CODE_SUCCESS
;
}
int
stmtPrepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
)
{
return
TSDB_CODE_SUCCESS
;
}
int
stmtSetTbNameTags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
)
{
return
TSDB_CODE_SUCCESS
;
}
int
stmtIsInsert
(
TAOS_STMT
*
stmt
,
int
*
insert
)
{
return
TSDB_CODE_SUCCESS
;
}
int
stmtGetParamNum
(
TAOS_STMT
*
stmt
,
int
*
nums
)
{
return
TSDB_CODE_SUCCESS
;
}
int
stmtAddBatch
(
TAOS_STMT
*
stmt
)
{
return
TSDB_CODE_SUCCESS
;
}
TAOS_RES
*
stmtUseResult
(
TAOS_STMT
*
stmt
)
{
return
NULL
;
}
int
stmtBindBatch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
)
{
return
TSDB_CODE_SUCCESS
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录