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
This commit is contained in:
Shuduo Sang 2022-03-30 11:31:59 +08:00 committed by GitHub
parent 869ce1e060
commit 2a422c3abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 0 deletions

View File

@ -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();

View File

@ -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;