From e73d98456d970a6d10a376e4dcf1d07610368dab Mon Sep 17 00:00:00 2001 From: Linhe Huo Date: Mon, 24 Mar 2025 22:04:32 +0800 Subject: [PATCH] chore: fix taos_data_type/errno/errstr() error before taos_init() call (#30414) --- source/client/wrapper/src/wrapperFunc.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source/client/wrapper/src/wrapperFunc.c b/source/client/wrapper/src/wrapperFunc.c index ed5200c064..7797b0a586 100644 --- a/source/client/wrapper/src/wrapperFunc.c +++ b/source/client/wrapper/src/wrapperFunc.c @@ -170,6 +170,7 @@ void taos_close(TAOS *taos) { } const char *taos_data_type(int type) { + (void)taos_init(); CHECK_PTR(fp_taos_data_type); return (*fp_taos_data_type)(type); } @@ -504,6 +505,7 @@ int taos_get_current_db(TAOS *taos, char *database, int len, int *required) { } const char *taos_errstr(TAOS_RES *res) { + (void)taos_init(); if (fp_taos_errstr == NULL) { return tstrerror(terrno); } @@ -511,6 +513,7 @@ const char *taos_errstr(TAOS_RES *res) { } int taos_errno(TAOS_RES *res) { + (void)taos_init(); if (fp_taos_errno == NULL) { return terrno; } @@ -649,7 +652,7 @@ TAOS_RES *taos_schemaless_insert_ttl_with_reqid_tbname_key(TAOS *taos, char *lin } tmq_conf_t *tmq_conf_new() { - taos_init(); + (void)taos_init(); CHECK_PTR(fp_tmq_conf_new); return (*fp_tmq_conf_new)(); } @@ -670,7 +673,7 @@ void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *para } tmq_list_t *tmq_list_new() { - taos_init(); + (void)taos_init(); CHECK_PTR(fp_tmq_list_new); return (*fp_tmq_list_new)(); } @@ -696,7 +699,7 @@ char **tmq_list_to_c_array(const tmq_list_t *tlist) { } tmq_t *tmq_consumer_new(tmq_conf_t *conf, char *errstr, int32_t errstrLen) { - taos_init(); + (void)taos_init(); CHECK_PTR(fp_tmq_consumer_new); return (*fp_tmq_consumer_new)(conf, errstr, errstrLen); } @@ -866,13 +869,13 @@ TSDB_SERVER_STATUS taos_check_server_status(const char *fqdn, int port, char *de } void taos_write_crashinfo(int signum, void *sigInfo, void *context) { - taos_init(); + (void)taos_init(); CHECK_VOID(fp_taos_write_crashinfo); (*fp_taos_write_crashinfo)(signum, sigInfo, context); } char *getBuildInfo() { - taos_init(); + (void)taos_init(); CHECK_PTR(fp_getBuildInfo); return (*fp_getBuildInfo)(); }