From 2a422c3abb05d0200c42bcc6b934dbaa5c2ed477 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 30 Mar 2022 11:31:59 +0800 Subject: [PATCH] Feature/sangshuduo/td 13603 python connector (#11114) * add a few stmt_ interface declartion * add taos_load_table_info * add taos_set_config(() interface * add more interfaces --- include/client/taos.h | 20 ++++++++++++++++++++ source/client/src/clientMain.c | 21 +++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/include/client/taos.h b/include/client/taos.h index 0260316618..111cd8ad3b 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -124,8 +124,25 @@ typedef struct TAOS_MULTI_BIND { int num; } TAOS_MULTI_BIND; +typedef enum { + SET_CONF_RET_SUCC = 0, + SET_CONF_RET_ERR_PART = -1, + SET_CONF_RET_ERR_INNER = -2, + SET_CONF_RET_ERR_JSON_INVALID = -3, + SET_CONF_RET_ERR_JSON_PARSE = -4, + SET_CONF_RET_ERR_ONLY_ONCE = -5, + SET_CONF_RET_ERR_TOO_LONG = -6 +} SET_CONF_RET_CODE; + +#define RET_MSG_LENGTH 1024 +typedef struct setConfRet { + SET_CONF_RET_CODE retCode; + char retMsg[RET_MSG_LENGTH]; +} setConfRet; + DLL_EXPORT void taos_cleanup(void); DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...); +DLL_EXPORT setConfRet taos_set_config(const char *config); DLL_EXPORT TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port); DLL_EXPORT TAOS *taos_connect_l(const char *ip, int ipLen, const char *user, int userLen, const char *pass, int passLen, const char *db, int dbLen, uint16_t port); @@ -168,10 +185,13 @@ DLL_EXPORT int taos_select_db(TAOS *taos, const char *db); DLL_EXPORT int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields); DLL_EXPORT void taos_stop_query(TAOS_RES *res); DLL_EXPORT bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col); +DLL_EXPORT bool taos_is_update_query(TAOS_RES *res); DLL_EXPORT int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows); DLL_EXPORT int taos_validate_sql(TAOS *taos, const char *sql); +DLL_EXPORT void taos_reset_current_db(TAOS *taos); DLL_EXPORT int *taos_fetch_lengths(TAOS_RES *res); +DLL_EXPORT TAOS_ROW *taos_result_block(TAOS_RES *res); DLL_EXPORT const char *taos_get_server_info(TAOS *taos); DLL_EXPORT const char *taos_get_client_info(); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 40c601f63f..42d4b5b2e5 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -71,6 +71,12 @@ void taos_cleanup(void) { tscInfo("all local resources released"); } +setConfRet taos_set_config(const char *config) { + // TODO + setConfRet ret = {SET_CONF_RET_SUCC, {0}}; + return ret; +} + TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) { tscDebug("try to connect to %s:%u, user:%s db:%s", ip, port, user, db); if (user == NULL) { @@ -257,6 +263,11 @@ int *taos_fetch_lengths(TAOS_RES *res) { return ((SRequestObj *)res)->body.resInfo.length; } +TAOS_ROW *taos_result_block(TAOS_RES *res) { + // TODO + return NULL; +} + // todo intergrate with tDataTypes const char *taos_data_type(int type) { switch (type) { @@ -353,6 +364,11 @@ bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col) { return colDataIsNull_f(pCol->nullbitmap, row); } +bool taos_is_update_query(TAOS_RES *res) { + // TODO + return true; +} + int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) { if (res == NULL) { return 0; @@ -376,6 +392,11 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) { int taos_validate_sql(TAOS *taos, const char *sql) { return true; } +void taos_reset_current_db(TAOS *taos) { + // TODO + return; +} + const char *taos_get_server_info(TAOS *taos) { if (taos == NULL) { return NULL; -- GitLab