提交 a823535f 编写于 作者: D dapan1121

stmt

上级 36244066
...@@ -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
} }
......
...@@ -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", __FUNCTION__);
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", __FUNCTION__);
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", __FUNCTION__);
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", __FUNCTION__);
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", __FUNCTION__);
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", __FUNCTION__);
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", __FUNCTION__);
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", __FUNCTION__);
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", __FUNCTION__);
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", __FUNCTION__);
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", __FUNCTION__);
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", __FUNCTION__);
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", __FUNCTION__);
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", __FUNCTION__);
terrno = TSDB_CODE_INVALID_PARA; terrno = TSDB_CODE_INVALID_PARA;
return terrno; return terrno;
} }
......
#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.
先完成此消息的编辑!
想要评论请 注册