diff --git a/source/client/inc/clientStmt.h b/source/client/inc/clientStmt.h index e358ce37aa948ab08eb4658609693199556eb48a..c29361758dda67b079ca613651550c8d3ccb5ca8 100644 --- a/source/client/inc/clientStmt.h +++ b/source/client/inc/clientStmt.h @@ -28,18 +28,33 @@ typedef enum { typedef struct STscStmt { STMT_TYPE type; - int16_t last; - STscObj* taos; - SSqlObj* pSql; - SMultiTbStmt mtb; - SNormalStmt normal; + //int16_t last; + //STscObj* taos; + //SSqlObj* pSql; + //SMultiTbStmt mtb; + //SNormalStmt normal; - int numOfRows; + //int numOfRows; } STscStmt; -#define SCH_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 SCH_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0) +#define STMT_ERR_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 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 } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index e9d1ca0d24ad484d7517f86929a19e0870dfbe9b..84f9c7ac30042788a2d08b9321769638395db97a 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -16,6 +16,7 @@ #include "catalog.h" #include "scheduler.h" #include "clientInt.h" +#include "clientStmt.h" #include "clientLog.h" #include "os.h" #include "query.h" @@ -560,7 +561,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) { TAOS_STMT *taos_stmt_init(TAOS *taos) { if (taos == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return NULL; } @@ -570,7 +571,7 @@ TAOS_STMT *taos_stmt_init(TAOS *taos) { int taos_stmt_close(TAOS_STMT *stmt) { if (stmt == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -580,7 +581,7 @@ int taos_stmt_close(TAOS_STMT *stmt) { int taos_stmt_execute(TAOS_STMT *stmt) { if (stmt == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -590,7 +591,7 @@ int taos_stmt_execute(TAOS_STMT *stmt) { char *taos_stmt_errstr(TAOS_STMT *stmt) { if (stmt == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return NULL; } @@ -600,7 +601,7 @@ char *taos_stmt_errstr(TAOS_STMT *stmt) { int taos_stmt_affected_rows(TAOS_STMT *stmt) { if (stmt == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return 0; } @@ -610,7 +611,7 @@ int taos_stmt_affected_rows(TAOS_STMT *stmt) { int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind) { if (stmt == NULL || bind == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -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) { if (stmt == NULL || sql == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -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) { if (stmt == NULL || name == NULL || tags == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -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) { if (stmt == NULL || name == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -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) { if (stmt == NULL || insert == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -660,7 +661,7 @@ int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert) { int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) { if (stmt == NULL || nums == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -670,7 +671,7 @@ int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) { int taos_stmt_add_batch(TAOS_STMT *stmt) { if (stmt == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -680,9 +681,9 @@ int taos_stmt_add_batch(TAOS_STMT *stmt) { TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt) { if (stmt == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; - return terrno; + return NULL; } return stmtUseResult(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) { if (stmt == NULL || bind == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index 2d8a48938192be0110420ddfe3f5686a962f88e8..8c4cff92514cc8c850c9a25458865c1741cf2045 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -1,6 +1,7 @@ #include "clientInt.h" #include "clientLog.h" +#include "clientStmt.h" #include "tdef.h" TAOS_STMT *stmtInit(TAOS *taos) { @@ -46,3 +47,53 @@ TAOS_STMT *stmtInit(TAOS *taos) { 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; +} + + +