• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

taosdata / TDengine / #3798

31 Mar 2025 10:39AM UTC coverage: 9.424% (-20.9%) from 30.372%
#3798

push

travis-ci

happyguoxy
test:add test cases

21549 of 307601 branches covered (7.01%)

Branch coverage included in aggregate %.

36084 of 303967 relevant lines covered (11.87%)

58620.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

13.2
/source/client/wrapper/src/wrapperFunc.c
1
/*
2
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
3
 *
4
 * This program is free software: you can use, redistribute, and/or modify
5
 * it under the terms of the GNU Affero General Public License, version 3
6
 * or later ("AGPL"), as published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
 * FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * You should have received a copy of the GNU Affero General Public License
13
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14
 */
15

16
#include "version.h"
17
#include "wrapper.h"
18

19
static TdThreadOnce tsDriverOnce = PTHREAD_ONCE_INIT;
20
volatile int32_t    tsDriverOnceRet = 0;
21

22
static TdThreadOnce tsInitOnce = PTHREAD_ONCE_INIT;
23
volatile int32_t    tsInitOnceRet = 0;
24

25
#define ERR_VOID(code) \
26
  terrno = code;       \
27
  return;
28

29
#define ERR_PTR(code) \
30
  terrno = code;      \
31
  return NULL;
32

33
#define ERR_INT(code) \
34
  terrno = code;      \
35
  return -1;
36

37
#define ERR_BOOL(code) \
38
  terrno = code;       \
39
  return false;
40

41
#define ERR_CONFRET(code)           \
42
  terrno = code;                    \
43
  setConfRet ret = {.retCode = -1}; \
44
  return ret;
45

46
#define CHECK_VOID(fp)               \
47
  if (tsDriver == NULL) {            \
48
    ERR_VOID(TSDB_CODE_DLL_NOT_LOAD) \
49
  }                                  \
50
  if (fp == NULL) {                  \
51
    ERR_VOID(TSDB_CODE_DLL_NOT_LOAD) \
52
  }
53

54
#define CHECK_PTR(fp)               \
55
  if (tsDriver == NULL) {           \
56
    ERR_PTR(TSDB_CODE_DLL_NOT_LOAD) \
57
  }                                 \
58
  if (fp == NULL) {                 \
59
    ERR_PTR(TSDB_CODE_DLL_NOT_LOAD) \
60
  }
61

62
#define CHECK_INT(fp)               \
63
  if (tsDriver == NULL) {           \
64
    ERR_INT(TSDB_CODE_DLL_NOT_LOAD) \
65
  }                                 \
66
  if (fp == NULL) {                 \
67
    ERR_INT(TSDB_CODE_DLL_NOT_LOAD) \
68
  }
69

70
#define CHECK_BOOL(fp)               \
71
  if (tsDriver == NULL) {            \
72
    ERR_BOOL(TSDB_CODE_DLL_NOT_LOAD) \
73
  }                                  \
74
  if (fp == NULL) {                  \
75
    ERR_BOOL(TSDB_CODE_DLL_NOT_LOAD) \
76
  }
77

78
#define CHECK_CONFRET(fp)               \
79
  if (tsDriver == NULL) {               \
80
    ERR_CONFRET(TSDB_CODE_DLL_NOT_LOAD) \
81
  }                                     \
82
  if (fp == NULL) {                     \
83
    ERR_CONFRET(TSDB_CODE_DLL_NOT_LOAD) \
84
  }
85

86
setConfRet taos_set_config(const char *config) {
×
87
  if (taos_init() != 0) {
×
88
    ERR_CONFRET(TSDB_CODE_DLL_NOT_LOAD)
×
89
  }
90

91
  CHECK_CONFRET(fp_taos_set_config);
×
92
  return (*fp_taos_set_config)(config);
×
93
}
94

95
static void taos_init_driver(void) {
20✔
96
  tsDriverOnceRet = taosDriverInit(tsDriverType);
20✔
97
  if (tsDriverOnceRet != 0) return;
20!
98

99
  tsDriverOnceRet = 0;
20✔
100
}
101
static void taos_init_wrapper(void) {
20✔
102
  if (fp_taos_init == NULL) {
20!
103
    terrno = TSDB_CODE_DLL_FUNC_NOT_LOAD;
×
104
    tsInitOnceRet = -1;
×
105
  } else {
106
    tsInitOnceRet = (*fp_taos_init)();
20✔
107
  }
108
}
20✔
109

110
int taos_init(void) {
5,840✔
111
  (void)taosThreadOnce(&tsDriverOnce, taos_init_driver);
5,840✔
112
  (void)taosThreadOnce(&tsInitOnce, taos_init_wrapper);
5,840✔
113
  return tsInitOnceRet;
5,840✔
114
}
115

116
void taos_cleanup(void) {
6✔
117
  CHECK_VOID(fp_taos_cleanup);
6!
118
  (*fp_taos_cleanup)();
6✔
119
}
120

121
int taos_options(TSDB_OPTION option, const void *arg, ...) {
25✔
122
  if (option == TSDB_OPTION_DRIVER) {
25✔
123
    if (tsDriver == NULL) {
6!
124
      if (strcasecmp((const char *)arg, "native") == 0) {
6!
125
        tsDriverType = DRIVER_NATIVE;
6✔
126
        return 0;
6✔
127
      }
128
      if (strcasecmp((const char *)arg, "websocket") == 0) {
×
129
        tsDriverType = DRIVER_WEBSOCKET;
×
130
        return 0;
×
131
      }
132
    }
133
    terrno = TSDB_CODE_REPEAT_INIT;
×
134
    return -1;
×
135
  }
136
  (void)taosThreadOnce(&tsDriverOnce, taos_init_driver);
19✔
137

138
  CHECK_INT(fp_taos_options);
19!
139
  return (*fp_taos_options)(option, arg);
19✔
140
}
141

142
int taos_options_connection(TAOS *taos, TSDB_OPTION_CONNECTION option, const void *arg, ...) {
×
143
  CHECK_INT(fp_taos_options_connection);
×
144
  return (*fp_taos_options_connection)(taos, option, (const char *)arg);
×
145
}
146

147
TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) {
44✔
148
  if (taos_init() != 0) {
44!
149
    //terrno = TSDB_CODE_DLL_NOT_LOAD;
150
    return NULL;
×
151
  }
152

153
  CHECK_PTR(fp_taos_connect);
44!
154
  return (*fp_taos_connect)(ip, user, pass, db, port);
44✔
155
}
156

157
TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port) {
×
158
  if (taos_init() != 0) {
×
159
    terrno = TSDB_CODE_DLL_NOT_LOAD;
×
160
    return NULL;
×
161
  }
162

163
  CHECK_PTR(fp_taos_connect_auth);
×
164
  return (*fp_taos_connect_auth)(ip, user, auth, db, port);
×
165
}
166

167
void taos_close(TAOS *taos) {
44✔
168
  CHECK_VOID(fp_taos_close);
44!
169
  (*fp_taos_close)(taos);
44✔
170
}
171

172
const char *taos_data_type(int type) {
×
173
  (void)taos_init();
×
174
  CHECK_PTR(fp_taos_data_type);
×
175
  return (*fp_taos_data_type)(type);
×
176
}
177

178
TAOS_STMT *taos_stmt_init(TAOS *taos) {
×
179
  CHECK_PTR(fp_taos_stmt_init);
×
180
  return (*fp_taos_stmt_init)(taos);
×
181
}
182

183
TAOS_STMT *taos_stmt_init_with_reqid(TAOS *taos, int64_t reqid) {
×
184
  CHECK_PTR(fp_taos_stmt_init_with_reqid);
×
185
  return (*fp_taos_stmt_init_with_reqid)(taos, reqid);
×
186
}
187

188
TAOS_STMT *taos_stmt_init_with_options(TAOS *taos, TAOS_STMT_OPTIONS *options) {
×
189
  CHECK_PTR(fp_taos_stmt_init_with_options);
×
190
  return (*fp_taos_stmt_init_with_options)(taos, options);
×
191
}
192

193
int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length) {
×
194
  CHECK_INT(fp_taos_stmt_prepare);
×
195
  return (*fp_taos_stmt_prepare)(stmt, sql, length);
×
196
}
197

198
int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_MULTI_BIND *tags) {
×
199
  CHECK_INT(fp_taos_stmt_set_tbname_tags);
×
200
  return (*fp_taos_stmt_set_tbname_tags)(stmt, name, tags);
×
201
}
202

203
int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name) {
×
204
  CHECK_INT(fp_taos_stmt_set_tbname);
×
205
  return (*fp_taos_stmt_set_tbname)(stmt, name);
×
206
}
207

208
int taos_stmt_set_tags(TAOS_STMT *stmt, TAOS_MULTI_BIND *tags) {
×
209
  CHECK_INT(fp_taos_stmt_set_tags);
×
210
  return (*fp_taos_stmt_set_tags)(stmt, tags);
×
211
}
212

213
int taos_stmt_set_sub_tbname(TAOS_STMT *stmt, const char *name) {
×
214
  CHECK_INT(fp_taos_stmt_set_sub_tbname);
×
215
  return (*fp_taos_stmt_set_sub_tbname)(stmt, name);
×
216
}
217

218
int taos_stmt_get_tag_fields(TAOS_STMT *stmt, int *fieldNum, TAOS_FIELD_E **fields) {
×
219
  CHECK_INT(fp_taos_stmt_get_tag_fields);
×
220
  return (*fp_taos_stmt_get_tag_fields)(stmt, fieldNum, fields);
×
221
}
222

223
int taos_stmt_get_col_fields(TAOS_STMT *stmt, int *fieldNum, TAOS_FIELD_E **fields) {
×
224
  CHECK_INT(fp_taos_stmt_get_col_fields);
×
225
  return (*fp_taos_stmt_get_col_fields)(stmt, fieldNum, fields);
×
226
}
227

228
void taos_stmt_reclaim_fields(TAOS_STMT *stmt, TAOS_FIELD_E *fields) {
×
229
  CHECK_VOID(fp_taos_stmt_reclaim_fields);
×
230
  (*fp_taos_stmt_reclaim_fields)(stmt, fields);
×
231
}
232

233
int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert) {
×
234
  CHECK_INT(fp_taos_stmt_is_insert);
×
235
  return (*fp_taos_stmt_is_insert)(stmt, insert);
×
236
}
237

238
int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) {
×
239
  CHECK_INT(fp_taos_stmt_num_params);
×
240
  return (*fp_taos_stmt_num_params)(stmt, nums);
×
241
}
242

243
int taos_stmt_get_param(TAOS_STMT *stmt, int idx, int *type, int *bytes) {
×
244
  CHECK_INT(fp_taos_stmt_get_param);
×
245
  return (*fp_taos_stmt_get_param)(stmt, idx, type, bytes);
×
246
}
247

248
int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) {
×
249
  CHECK_INT(fp_taos_stmt_bind_param);
×
250
  return (*fp_taos_stmt_bind_param)(stmt, bind);
×
251
}
252

253
int taos_stmt_bind_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) {
×
254
  CHECK_INT(fp_taos_stmt_bind_param_batch);
×
255
  return (*fp_taos_stmt_bind_param_batch)(stmt, bind);
×
256
}
257

258
int taos_stmt_bind_single_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind, int colIdx) {
×
259
  CHECK_INT(fp_taos_stmt_bind_single_param_batch);
×
260
  return (*fp_taos_stmt_bind_single_param_batch)(stmt, bind, colIdx);
×
261
}
262

263
int taos_stmt_add_batch(TAOS_STMT *stmt) {
×
264
  CHECK_INT(fp_taos_stmt_add_batch);
×
265
  return (*fp_taos_stmt_add_batch)(stmt);
×
266
}
267

268
int taos_stmt_execute(TAOS_STMT *stmt) {
×
269
  CHECK_INT(fp_taos_stmt_execute);
×
270
  return (*fp_taos_stmt_execute)(stmt);
×
271
}
272

273
TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt) {
×
274
  CHECK_PTR(fp_taos_stmt_use_result);
×
275
  return (*fp_taos_stmt_use_result)(stmt);
×
276
}
277

278
int taos_stmt_close(TAOS_STMT *stmt) {
×
279
  CHECK_INT(fp_taos_stmt_close);
×
280
  return (*fp_taos_stmt_close)(stmt);
×
281
}
282

283
char *taos_stmt_errstr(TAOS_STMT *stmt) {
×
284
  CHECK_PTR(fp_taos_stmt_errstr);
×
285
  return (*fp_taos_stmt_errstr)(stmt);
×
286
}
287

288
int taos_stmt_affected_rows(TAOS_STMT *stmt) {
×
289
  CHECK_INT(fp_taos_stmt_affected_rows);
×
290
  return (*fp_taos_stmt_affected_rows)(stmt);
×
291
}
292

293
int taos_stmt_affected_rows_once(TAOS_STMT *stmt) {
×
294
  CHECK_INT(fp_taos_stmt_affected_rows_once);
×
295
  return (*fp_taos_stmt_affected_rows_once)(stmt);
×
296
}
297

298
TAOS_STMT2 *taos_stmt2_init(TAOS *taos, TAOS_STMT2_OPTION *option) {
×
299
  CHECK_PTR(fp_taos_stmt2_init);
×
300
  return (*fp_taos_stmt2_init)(taos, option);
×
301
}
302

303
int taos_stmt2_prepare(TAOS_STMT2 *stmt, const char *sql, unsigned long length) {
×
304
  CHECK_INT(fp_taos_stmt2_prepare);
×
305
  return (*fp_taos_stmt2_prepare)(stmt, sql, length);
×
306
}
307

308
int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col_idx) {
×
309
  CHECK_INT(fp_taos_stmt2_bind_param);
×
310
  return (*fp_taos_stmt2_bind_param)(stmt, bindv, col_idx);
×
311
}
312

313
int taos_stmt2_bind_param_a(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col_idx, __taos_async_fn_t fp,
×
314
                            void *param) {
315
  CHECK_INT(fp_taos_stmt2_bind_param_a);
×
316
  return (*fp_taos_stmt2_bind_param_a)(stmt, bindv, col_idx, fp, param);
×
317
}
318

319
int taos_stmt2_exec(TAOS_STMT2 *stmt, int *affected_rows) {
×
320
  CHECK_INT(fp_taos_stmt2_exec);
×
321
  return (*fp_taos_stmt2_exec)(stmt, affected_rows);
×
322
}
323

324
int taos_stmt2_close(TAOS_STMT2 *stmt) {
×
325
  CHECK_INT(fp_taos_stmt2_close);
×
326
  return (*fp_taos_stmt2_close)(stmt);
×
327
}
328

329
int taos_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert) {
×
330
  CHECK_INT(fp_taos_stmt2_is_insert);
×
331
  return (*fp_taos_stmt2_is_insert)(stmt, insert);
×
332
}
333

334
int taos_stmt2_get_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_ALL **fields) {
×
335
  CHECK_INT(fp_taos_stmt2_get_fields);
×
336
  return (*fp_taos_stmt2_get_fields)(stmt, count, fields);
×
337
}
338

339
void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_ALL *fields) {
×
340
  CHECK_VOID(fp_taos_stmt2_free_fields);
×
341
  (*fp_taos_stmt2_free_fields)(stmt, fields);
×
342
}
343

344
TAOS_RES *taos_stmt2_result(TAOS_STMT2 *stmt) {
×
345
  CHECK_PTR(fp_taos_stmt2_result);
×
346
  return (*fp_taos_stmt2_result)(stmt);
×
347
}
348

349
char *taos_stmt2_error(TAOS_STMT2 *stmt) {
×
350
  CHECK_PTR(fp_taos_stmt2_error);
×
351
  return (*fp_taos_stmt2_error)(stmt);
×
352
}
353

354
TAOS_RES *taos_query(TAOS *taos, const char *sql) {
5,016✔
355
  CHECK_PTR(fp_taos_query);
5,016!
356
  return (*fp_taos_query)(taos, sql);
5,016✔
357
}
358

359
TAOS_RES *taos_query_with_reqid(TAOS *taos, const char *sql, int64_t reqId) {
×
360
  CHECK_PTR(fp_taos_query_with_reqid);
×
361
  return (*fp_taos_query_with_reqid)(taos, sql, reqId);
×
362
}
363

364
TAOS_ROW taos_fetch_row(TAOS_RES *res) {
143,715✔
365
  CHECK_PTR(fp_taos_fetch_row);
143,715!
366
  return (*fp_taos_fetch_row)(res);
143,715✔
367
}
368

369
int taos_result_precision(TAOS_RES *res) {
291✔
370
  CHECK_INT(fp_taos_result_precision);
291!
371
  return (*fp_taos_result_precision)(res);
291✔
372
}
373

374
void taos_free_result(TAOS_RES *res) {
5,015✔
375
  CHECK_VOID(fp_taos_free_result);
5,015!
376
  return (*fp_taos_free_result)(res);
5,015✔
377
}
378

379
void taos_kill_query(TAOS *taos) {
×
380
  CHECK_VOID(fp_taos_kill_query);
×
381
  return (*fp_taos_kill_query)(taos);
×
382
}
383

384
int taos_field_count(TAOS_RES *res) {
147,387✔
385
  CHECK_INT(fp_taos_field_count);
147,387!
386
  return (*fp_taos_field_count)(res);
147,387✔
387
}
388

389
int taos_num_fields(TAOS_RES *res) {
144,059✔
390
  CHECK_INT(fp_taos_num_fields);
144,059!
391
  return (*fp_taos_num_fields)(res);
144,059✔
392
}
393

394
int taos_affected_rows(TAOS_RES *res) {
2,495✔
395
  CHECK_INT(fp_taos_affected_rows);
2,495!
396
  return (*fp_taos_affected_rows)(res);
2,495✔
397
}
398

399
int64_t taos_affected_rows64(TAOS_RES *res) {
×
400
  CHECK_INT(fp_taos_affected_rows64);
×
401
  return (*fp_taos_affected_rows64)(res);
×
402
}
403

404
TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) {
330✔
405
  CHECK_PTR(fp_taos_fetch_fields);
330!
406
  return (*fp_taos_fetch_fields)(res);
330✔
407
}
408

409
TAOS_FIELD_E *taos_fetch_fields_e(TAOS_RES *res) {
×
410
  CHECK_PTR(fp_taos_fetch_fields_e);
×
411
  return (*fp_taos_fetch_fields_e)(res);
×
412
}
413

414
int taos_select_db(TAOS *taos, const char *db) {
×
415
  CHECK_INT(fp_taos_select_db);
×
416
  return (*fp_taos_select_db)(taos, db);
×
417
}
418

419
int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) {
×
420
  CHECK_INT(fp_taos_print_row);
×
421
  return (*fp_taos_print_row)(str, row, fields, num_fields);
×
422
}
423

424
int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) {
×
425
  CHECK_INT(fp_taos_print_row_with_size);
×
426
  return (*fp_taos_print_row_with_size)(str, size, row, fields, num_fields);
×
427
}
428

429
void taos_stop_query(TAOS_RES *res) {
2,129✔
430
  CHECK_VOID(fp_taos_stop_query);
2,129!
431
  (*fp_taos_stop_query)(res);
2,129✔
432
}
433

434
bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col) {
4,820,950✔
435
  CHECK_BOOL(fp_taos_is_null);
4,820,950!
436
  return (*fp_taos_is_null)(res, row, col);
4,820,950✔
437
}
438

439
int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *rows) {
×
440
  CHECK_INT(fp_taos_is_null_by_column);
×
441
  return (*fp_taos_is_null_by_column)(res, columnIndex, result, rows);
×
442
}
443

444
bool taos_is_update_query(TAOS_RES *res) {
×
445
  CHECK_BOOL(fp_taos_is_update_query);
×
446
  return (*fp_taos_is_update_query)(res);
×
447
}
448

449
int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
421✔
450
  CHECK_INT(fp_taos_fetch_block);
421!
451
  return (*fp_taos_fetch_block)(res, rows);
421✔
452
}
453

454
int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) {
×
455
  CHECK_INT(fp_taos_fetch_block_s);
×
456
  return (*fp_taos_fetch_block_s)(res, numOfRows, rows);
×
457
}
458

459
int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) {
×
460
  CHECK_INT(fp_taos_fetch_raw_block);
×
461
  return (*fp_taos_fetch_raw_block)(res, numOfRows, pData);
×
462
}
463

464
int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex) {
818✔
465
  CHECK_PTR(fp_taos_get_column_data_offset);
818!
466
  return (*fp_taos_get_column_data_offset)(res, columnIndex);
818✔
467
}
468

469
int taos_validate_sql(TAOS *taos, const char *sql) {
×
470
  CHECK_INT(fp_taos_validate_sql);
×
471
  return (*fp_taos_validate_sql)(taos, sql);
×
472
}
473

474
void taos_reset_current_db(TAOS *taos) {
×
475
  CHECK_VOID(fp_taos_reset_current_db);
×
476
  (*fp_taos_reset_current_db)(taos);
×
477
}
478

479
int *taos_fetch_lengths(TAOS_RES *res) {
143,714✔
480
  CHECK_PTR(fp_taos_fetch_lengths);
143,714!
481
  return (*fp_taos_fetch_lengths)(res);
143,714✔
482
}
483

484
TAOS_ROW *taos_result_block(TAOS_RES *res) {
×
485
  CHECK_PTR(fp_taos_result_block);
×
486
  return (*fp_taos_result_block)(res);
×
487
}
488

489
const char *taos_get_server_info(TAOS *taos) {
×
490
  CHECK_PTR(fp_taos_get_server_info);
×
491
  return (*fp_taos_get_server_info)(taos);
×
492
}
493

494
const char *taos_get_client_info() {
24✔
495
  if (fp_taos_get_client_info == NULL) {
24✔
496
    return td_version;
20✔
497
  } else {
498
    return (*fp_taos_get_client_info)();
4✔
499
  }
500
}
501

502
int taos_get_current_db(TAOS *taos, char *database, int len, int *required) {
×
503
  CHECK_INT(fp_taos_get_current_db);
×
504
  return (*fp_taos_get_current_db)(taos, database, len, required);
×
505
}
506

507
const char *taos_errstr(TAOS_RES *res) {
238✔
508
  (void)taos_init();
238✔
509
  if (fp_taos_errstr == NULL) {
238!
510
    return tstrerror(terrno);
×
511
  }
512
  return (*fp_taos_errstr)(res);
238✔
513
}
514

515
int taos_errno(TAOS_RES *res) {
5,526✔
516
  (void)taos_init();
5,526✔
517
  if (fp_taos_errno == NULL) {
5,526!
518
    return terrno;
×
519
  }
520
  return (*fp_taos_errno)(res);
5,526✔
521
}
522

523
void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param) {
×
524
  CHECK_VOID(fp_taos_query_a);
×
525
  (*fp_taos_query_a)(taos, sql, fp, param);
×
526
}
527

528
void taos_query_a_with_reqid(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param, int64_t reqid) {
×
529
  CHECK_VOID(fp_taos_query_a_with_reqid);
×
530
  (*fp_taos_query_a_with_reqid)(taos, sql, fp, param, reqid);
×
531
}
532

533
void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
158✔
534
  CHECK_VOID(fp_taos_fetch_rows_a);
158!
535
  (*fp_taos_fetch_rows_a)(res, fp, param);
158✔
536
}
537

538
void taos_fetch_raw_block_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
×
539
  CHECK_VOID(fp_taos_fetch_raw_block_a);
×
540
  (*fp_taos_fetch_raw_block_a)(res, fp, param);
×
541
}
542

543
const void *taos_get_raw_block(TAOS_RES *res) {
×
544
  CHECK_PTR(fp_taos_get_raw_block);
×
545
  return (*fp_taos_get_raw_block)(res);
×
546
}
547

548
int taos_get_db_route_info(TAOS *taos, const char *db, TAOS_DB_ROUTE_INFO *dbInfo) {
×
549
  CHECK_INT(fp_taos_get_db_route_info);
×
550
  return (*fp_taos_get_db_route_info)(taos, db, dbInfo);
×
551
}
552

553
int taos_get_table_vgId(TAOS *taos, const char *db, const char *table, int *vgId) {
×
554
  CHECK_INT(fp_taos_get_table_vgId);
×
555
  return (*fp_taos_get_table_vgId)(taos, db, table, vgId);
×
556
}
557

558
int taos_get_tables_vgId(TAOS *taos, const char *db, const char *table[], int tableNum, int *vgId) {
×
559
  CHECK_INT(fp_taos_get_tables_vgId);
×
560
  return (*fp_taos_get_tables_vgId)(taos, db, table, tableNum, vgId);
×
561
}
562

563
int taos_load_table_info(TAOS *taos, const char *tableNameList) {
×
564
  CHECK_INT(fp_taos_load_table_info);
×
565
  return (*fp_taos_load_table_info)(taos, tableNameList);
×
566
}
567

568
void taos_set_hb_quit(int8_t quitByKill) {
4✔
569
  if (taos_init() != 0) {
4!
570
    return;
×
571
  }
572

573
  CHECK_VOID(fp_taos_set_hb_quit);
4!
574
  return (*fp_taos_set_hb_quit)(quitByKill);
4✔
575
}
576

577
int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param, int type) {
×
578
  CHECK_INT(fp_taos_set_notify_cb);
×
579
  return (*fp_taos_set_notify_cb)(taos, fp, param, type);
×
580
}
581

582
void taos_fetch_whitelist_a(TAOS *taos, __taos_async_whitelist_fn_t fp, void *param) {
×
583
  CHECK_VOID(fp_taos_fetch_whitelist_a);
×
584
  return (*fp_taos_fetch_whitelist_a)(taos, fp, param);
×
585
}
586

587
int taos_set_conn_mode(TAOS *taos, int mode, int value) {
×
588
  CHECK_INT(fp_taos_set_conn_mode);
×
589
  return (*fp_taos_set_conn_mode)(taos, mode, value);
×
590
}
591

592
TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision) {
×
593
  CHECK_PTR(fp_taos_schemaless_insert);
×
594
  return (*fp_taos_schemaless_insert)(taos, lines, numLines, protocol, precision);
×
595
}
596

597
TAOS_RES *taos_schemaless_insert_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision,
×
598
                                            int64_t reqid) {
599
  CHECK_PTR(fp_taos_schemaless_insert_with_reqid);
×
600
  return (*fp_taos_schemaless_insert_with_reqid)(taos, lines, numLines, protocol, precision, reqid);
×
601
}
602

603
TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol,
×
604
                                     int precision) {
605
  CHECK_PTR(fp_taos_schemaless_insert_raw);
×
606
  return (*fp_taos_schemaless_insert_raw)(taos, lines, len, totalRows, protocol, precision);
×
607
}
608

609
TAOS_RES *taos_schemaless_insert_raw_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol,
×
610
                                                int precision, int64_t reqid) {
611
  CHECK_PTR(fp_taos_schemaless_insert_raw_with_reqid);
×
612
  return (*fp_taos_schemaless_insert_raw_with_reqid)(taos, lines, len, totalRows, protocol, precision, reqid);
×
613
}
614

615
TAOS_RES *taos_schemaless_insert_ttl(TAOS *taos, char *lines[], int numLines, int protocol, int precision,
×
616
                                     int32_t ttl) {
617
  CHECK_PTR(fp_taos_schemaless_insert_ttl);
×
618
  return (*fp_taos_schemaless_insert_ttl)(taos, lines, numLines, protocol, precision, ttl);
×
619
}
620

621
TAOS_RES *taos_schemaless_insert_ttl_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision,
×
622
                                                int32_t ttl, int64_t reqid) {
623
  CHECK_PTR(fp_taos_schemaless_insert_ttl_with_reqid);
×
624
  return (*fp_taos_schemaless_insert_ttl_with_reqid)(taos, lines, numLines, protocol, precision, ttl, reqid);
×
625
}
626

627
TAOS_RES *taos_schemaless_insert_raw_ttl(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol,
×
628
                                         int precision, int32_t ttl) {
629
  CHECK_PTR(fp_taos_schemaless_insert_raw_ttl);
×
630
  return (*fp_taos_schemaless_insert_raw_ttl)(taos, lines, len, totalRows, protocol, precision, ttl);
×
631
}
632

633
TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol,
×
634
                                                    int precision, int32_t ttl, int64_t reqid) {
635
  CHECK_PTR(fp_taos_schemaless_insert_raw_ttl_with_reqid);
×
636
  return (*fp_taos_schemaless_insert_raw_ttl_with_reqid)(taos, lines, len, totalRows, protocol, precision, ttl, reqid);
×
637
}
638

639
TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid_tbname_key(TAOS *taos, char *lines, int len, int32_t *totalRows,
×
640
                                                               int protocol, int precision, int32_t ttl, int64_t reqid,
641
                                                               char *tbnameKey) {
642
  CHECK_PTR(fp_taos_schemaless_insert_raw_ttl_with_reqid_tbname_key);
×
643
  return (*fp_taos_schemaless_insert_raw_ttl_with_reqid_tbname_key)(taos, lines, len, totalRows, protocol, precision,
×
644
                                                                    ttl, reqid, tbnameKey);
645
}
646

647
TAOS_RES *taos_schemaless_insert_ttl_with_reqid_tbname_key(TAOS *taos, char *lines[], int numLines, int protocol,
×
648
                                                           int precision, int32_t ttl, int64_t reqid, char *tbnameKey) {
649
  CHECK_PTR(fp_taos_schemaless_insert_ttl_with_reqid_tbname_key);
×
650
  return (*fp_taos_schemaless_insert_ttl_with_reqid_tbname_key)(taos, lines, numLines, protocol, precision, ttl, reqid,
×
651
                                                                tbnameKey);
652
}
653

654
tmq_conf_t *tmq_conf_new() {
×
655
  (void)taos_init();
×
656
  CHECK_PTR(fp_tmq_conf_new);
×
657
  return (*fp_tmq_conf_new)();
×
658
}
659

660
tmq_conf_res_t tmq_conf_set(tmq_conf_t *conf, const char *key, const char *value) {
×
661
  CHECK_INT(fp_tmq_conf_set);
×
662
  return (*fp_tmq_conf_set)(conf, key, value);
×
663
}
664

665
void tmq_conf_destroy(tmq_conf_t *conf) {
×
666
  CHECK_VOID(fp_tmq_conf_destroy);
×
667
  (*fp_tmq_conf_destroy)(conf);
×
668
}
669

670
void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param) {
×
671
  CHECK_VOID(fp_tmq_conf_set_auto_commit_cb);
×
672
  (*fp_tmq_conf_set_auto_commit_cb)(conf, cb, param);
×
673
}
674

675
tmq_list_t *tmq_list_new() {
×
676
  (void)taos_init();
×
677
  CHECK_PTR(fp_tmq_list_new);
×
678
  return (*fp_tmq_list_new)();
×
679
}
680

681
int32_t tmq_list_append(tmq_list_t *tlist, const char *val) {
×
682
  CHECK_INT(fp_tmq_list_append);
×
683
  return (*fp_tmq_list_append)(tlist, val);
×
684
}
685

686
void tmq_list_destroy(tmq_list_t *tlist) {
×
687
  CHECK_VOID(fp_tmq_list_destroy);
×
688
  (*fp_tmq_list_destroy)(tlist);
×
689
}
690

691
int32_t tmq_list_get_size(const tmq_list_t *tlist) {
×
692
  CHECK_INT(fp_tmq_list_get_size);
×
693
  return (*fp_tmq_list_get_size)(tlist);
×
694
}
695

696
char **tmq_list_to_c_array(const tmq_list_t *tlist) {
×
697
  CHECK_PTR(fp_tmq_list_to_c_array);
×
698
  return (*fp_tmq_list_to_c_array)(tlist);
×
699
}
700

701
tmq_t *tmq_consumer_new(tmq_conf_t *conf, char *errstr, int32_t errstrLen) {
×
702
  (void)taos_init();
×
703
  CHECK_PTR(fp_tmq_consumer_new);
×
704
  return (*fp_tmq_consumer_new)(conf, errstr, errstrLen);
×
705
}
706

707
int32_t tmq_subscribe(tmq_t *tmq, const tmq_list_t *topic_list) {
×
708
  CHECK_INT(fp_tmq_subscribe);
×
709
  return (*fp_tmq_subscribe)(tmq, topic_list);
×
710
}
711

712
int32_t tmq_unsubscribe(tmq_t *tmq) {
×
713
  CHECK_INT(fp_tmq_unsubscribe);
×
714
  return (*fp_tmq_unsubscribe)(tmq);
×
715
}
716

717
int32_t tmq_subscription(tmq_t *tmq, tmq_list_t **topics) {
×
718
  CHECK_INT(fp_tmq_subscription);
×
719
  return (*fp_tmq_subscription)(tmq, topics);
×
720
}
721

722
TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t timeout) {
×
723
  CHECK_PTR(fp_tmq_consumer_poll);
×
724
  return (*fp_tmq_consumer_poll)(tmq, timeout);
×
725
}
726

727
int32_t tmq_consumer_close(tmq_t *tmq) {
×
728
  CHECK_INT(fp_tmq_consumer_close);
×
729
  return (*fp_tmq_consumer_close)(tmq);
×
730
}
731

732
int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg) {
×
733
  CHECK_INT(fp_tmq_commit_sync);
×
734
  return (*fp_tmq_commit_sync)(tmq, msg);
×
735
}
736

737
void tmq_commit_async(tmq_t *tmq, const TAOS_RES *msg, tmq_commit_cb *cb, void *param) {
×
738
  CHECK_VOID(fp_tmq_commit_async);
×
739
  (*fp_tmq_commit_async)(tmq, msg, cb, param);
×
740
}
741

742
int32_t tmq_commit_offset_sync(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset) {
×
743
  CHECK_INT(fp_tmq_commit_offset_sync);
×
744
  return (*fp_tmq_commit_offset_sync)(tmq, pTopicName, vgId, offset);
×
745
}
746

747
void tmq_commit_offset_async(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset, tmq_commit_cb *cb,
×
748
                             void *param) {
749
  CHECK_VOID(fp_tmq_commit_offset_async);
×
750
  (*fp_tmq_commit_offset_async)(tmq, pTopicName, vgId, offset, cb, param);
×
751
}
752

753
int32_t tmq_get_topic_assignment(tmq_t *tmq, const char *pTopicName, tmq_topic_assignment **assignment,
×
754
                                 int32_t *numOfAssignment) {
755
  CHECK_INT(fp_tmq_get_topic_assignment);
×
756
  return (*fp_tmq_get_topic_assignment)(tmq, pTopicName, assignment, numOfAssignment);
×
757
}
758

759
void tmq_free_assignment(tmq_topic_assignment *pAssignment) {
×
760
  CHECK_VOID(fp_tmq_free_assignment);
×
761
  (*fp_tmq_free_assignment)(pAssignment);
×
762
}
763

764
int32_t tmq_offset_seek(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset) {
×
765
  CHECK_INT(fp_tmq_offset_seek);
×
766
  return (*fp_tmq_offset_seek)(tmq, pTopicName, vgId, offset);
×
767
}
768

769
int64_t tmq_position(tmq_t *tmq, const char *pTopicName, int32_t vgId) {
×
770
  CHECK_INT(fp_tmq_position);
×
771
  return (*fp_tmq_position)(tmq, pTopicName, vgId);
×
772
}
773

774
int64_t tmq_committed(tmq_t *tmq, const char *pTopicName, int32_t vgId) {
×
775
  CHECK_INT(fp_tmq_committed);
×
776
  return (*fp_tmq_committed)(tmq, pTopicName, vgId);
×
777
}
778

779
TAOS *tmq_get_connect(tmq_t *tmq) {
×
780
  CHECK_PTR(fp_tmq_get_connect);
×
781
  return (*fp_tmq_get_connect)(tmq);
×
782
}
783

784
const char *tmq_get_table_name(TAOS_RES *res) {
×
785
  CHECK_PTR(fp_tmq_get_table_name);
×
786
  return (*fp_tmq_get_table_name)(res);
×
787
}
788

789
tmq_res_t tmq_get_res_type(TAOS_RES *res) {
×
790
  CHECK_INT(fp_tmq_get_res_type);
×
791
  return (*fp_tmq_get_res_type)(res);
×
792
}
793

794
const char *tmq_get_topic_name(TAOS_RES *res) {
×
795
  CHECK_PTR(fp_tmq_get_topic_name);
×
796
  return (*fp_tmq_get_topic_name)(res);
×
797
}
798

799
const char *tmq_get_db_name(TAOS_RES *res) {
×
800
  CHECK_PTR(fp_tmq_get_db_name);
×
801
  return (*fp_tmq_get_db_name)(res);
×
802
}
803

804
int32_t tmq_get_vgroup_id(TAOS_RES *res) {
×
805
  CHECK_INT(fp_tmq_get_vgroup_id);
×
806
  return (*fp_tmq_get_vgroup_id)(res);
×
807
}
808

809
int64_t tmq_get_vgroup_offset(TAOS_RES *res) {
×
810
  CHECK_INT(fp_tmq_get_vgroup_offset);
×
811
  return (*fp_tmq_get_vgroup_offset)(res);
×
812
}
813

814
const char *tmq_err2str(int32_t code) {
×
815
  CHECK_PTR(fp_tmq_err2str);
×
816
  return (*fp_tmq_err2str)(code);
×
817
}
818

819
int32_t tmq_get_raw(TAOS_RES *res, tmq_raw_data *raw) {
×
820
  CHECK_INT(fp_tmq_get_raw);
×
821
  return (*fp_tmq_get_raw)(res, raw);
×
822
}
823

824
int32_t tmq_write_raw(TAOS *taos, tmq_raw_data raw) {
×
825
  CHECK_INT(fp_tmq_write_raw);
×
826
  return (*fp_tmq_write_raw)(taos, raw);
×
827
}
828

829
int taos_write_raw_block(TAOS *taos, int numOfRows, char *pData, const char *tbname) {
×
830
  CHECK_INT(fp_taos_write_raw_block);
×
831
  return (*fp_taos_write_raw_block)(taos, numOfRows, pData, tbname);
×
832
}
833

834
int taos_write_raw_block_with_reqid(TAOS *taos, int numOfRows, char *pData, const char *tbname, int64_t reqid) {
×
835
  CHECK_INT(fp_taos_write_raw_block_with_reqid);
×
836
  return (*fp_taos_write_raw_block_with_reqid)(taos, numOfRows, pData, tbname, reqid);
×
837
}
838

839
int taos_write_raw_block_with_fields(TAOS *taos, int rows, char *pData, const char *tbname, TAOS_FIELD *fields,
×
840
                                     int numFields) {
841
  CHECK_INT(fp_taos_write_raw_block_with_fields);
×
842
  return (*fp_taos_write_raw_block_with_fields)(taos, rows, pData, tbname, fields, numFields);
×
843
}
844

845
int taos_write_raw_block_with_fields_with_reqid(TAOS *taos, int rows, char *pData, const char *tbname,
×
846
                                                TAOS_FIELD *fields, int numFields, int64_t reqid) {
847
  CHECK_INT(fp_taos_write_raw_block_with_fields_with_reqid);
×
848
  return (*fp_taos_write_raw_block_with_fields_with_reqid)(taos, rows, pData, tbname, fields, numFields, reqid);
×
849
}
850

851
void tmq_free_raw(tmq_raw_data raw) {
×
852
  CHECK_VOID(fp_tmq_free_raw);
×
853
  (*fp_tmq_free_raw)(raw);
×
854
}
855

856
char *tmq_get_json_meta(TAOS_RES *res) {
×
857
  CHECK_PTR(fp_tmq_get_json_meta);
×
858
  return (*fp_tmq_get_json_meta)(res);
×
859
}
860

861
void tmq_free_json_meta(char *jsonMeta) {
×
862
  CHECK_VOID(fp_tmq_free_json_meta);
×
863
  return (*fp_tmq_free_json_meta)(jsonMeta);
×
864
}
865

866
TSDB_SERVER_STATUS taos_check_server_status(const char *fqdn, int port, char *details, int maxlen) {
×
867
  CHECK_INT(fp_taos_check_server_status);
×
868
  return (*fp_taos_check_server_status)(fqdn, port, details, maxlen);
×
869
}
870

871
void taos_write_crashinfo(int signum, void *sigInfo, void *context) {
×
872
  (void)taos_init();
×
873
  CHECK_VOID(fp_taos_write_crashinfo);
×
874
  (*fp_taos_write_crashinfo)(signum, sigInfo, context);
×
875
}
876

877
char *getBuildInfo() {
×
878
  (void)taos_init();
×
879
  CHECK_PTR(fp_getBuildInfo);
×
880
  return (*fp_getBuildInfo)();
×
881
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc