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

taosdata / TDengine / #3831

02 Apr 2025 01:14AM UTC coverage: 34.081% (-0.02%) from 34.097%
#3831

push

travis-ci

happyguoxy
test:alter gcda dir

148596 of 599532 branches covered (24.79%)

Branch coverage included in aggregate %.

222550 of 489473 relevant lines covered (45.47%)

1589752.67 hits per line

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

50.43
/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) {
6✔
87
  if (taos_init() != 0) {
6!
88
    ERR_CONFRET(TSDB_CODE_DLL_NOT_LOAD)
×
89
  }
90

91
  CHECK_CONFRET(fp_taos_set_config);
6!
92
  return (*fp_taos_set_config)(config);
6✔
93
}
94

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

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

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

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

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

138
  CHECK_INT(fp_taos_options);
552!
139
  return (*fp_taos_options)(option, arg);
552✔
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) {
8,067✔
148
  if (taos_init() != 0) {
8,067!
149
    //terrno = TSDB_CODE_DLL_NOT_LOAD;
150
    return NULL;
×
151
  }
152

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

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

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

167
void taos_close(TAOS *taos) {
8,010✔
168
  CHECK_VOID(fp_taos_close);
8,010!
169
  (*fp_taos_close)(taos);
8,010✔
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) {
258✔
179
  CHECK_PTR(fp_taos_stmt_init);
258!
180
  return (*fp_taos_stmt_init)(taos);
258✔
181
}
182

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

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

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

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

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

208
int taos_stmt_set_tags(TAOS_STMT *stmt, TAOS_MULTI_BIND *tags) {
60✔
209
  CHECK_INT(fp_taos_stmt_set_tags);
60!
210
  return (*fp_taos_stmt_set_tags)(stmt, tags);
60✔
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) {
30✔
219
  CHECK_INT(fp_taos_stmt_get_tag_fields);
30!
220
  return (*fp_taos_stmt_get_tag_fields)(stmt, fieldNum, fields);
30✔
221
}
222

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

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

233
int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert) {
300✔
234
  CHECK_INT(fp_taos_stmt_is_insert);
300!
235
  return (*fp_taos_stmt_is_insert)(stmt, insert);
300✔
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) {
624✔
249
  CHECK_INT(fp_taos_stmt_bind_param);
624!
250
  return (*fp_taos_stmt_bind_param)(stmt, bind);
624✔
251
}
252

253
int taos_stmt_bind_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) {
2,896,593✔
254
  CHECK_INT(fp_taos_stmt_bind_param_batch);
2,896,593!
255
  return (*fp_taos_stmt_bind_param_batch)(stmt, bind);
2,896,593✔
256
}
257

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

263
int taos_stmt_add_batch(TAOS_STMT *stmt) {
2,892,858✔
264
  CHECK_INT(fp_taos_stmt_add_batch);
2,892,858!
265
  return (*fp_taos_stmt_add_batch)(stmt);
2,892,858✔
266
}
267

268
int taos_stmt_execute(TAOS_STMT *stmt) {
8,118✔
269
  CHECK_INT(fp_taos_stmt_execute);
8,118!
270
  return (*fp_taos_stmt_execute)(stmt);
8,118✔
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) {
318✔
279
  CHECK_INT(fp_taos_stmt_close);
318!
280
  return (*fp_taos_stmt_close)(stmt);
318✔
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) {
6✔
289
  CHECK_INT(fp_taos_stmt_affected_rows);
6!
290
  return (*fp_taos_stmt_affected_rows)(stmt);
6✔
291
}
292

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

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

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

308
int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col_idx) {
612✔
309
  CHECK_INT(fp_taos_stmt2_bind_param);
612!
310
  return (*fp_taos_stmt2_bind_param)(stmt, bindv, col_idx);
612✔
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) {
612✔
320
  CHECK_INT(fp_taos_stmt2_exec);
612!
321
  return (*fp_taos_stmt2_exec)(stmt, affected_rows);
612✔
322
}
323

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

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

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

339
void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_ALL *fields) {
3✔
340
  CHECK_VOID(fp_taos_stmt2_free_fields);
3!
341
  (*fp_taos_stmt2_free_fields)(stmt, fields);
3✔
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) {
372,696✔
355
  CHECK_PTR(fp_taos_query);
372,696!
356
  return (*fp_taos_query)(taos, sql);
372,696✔
357
}
358

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

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

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

374
void taos_free_result(TAOS_RES *res) {
377,025✔
375
  CHECK_VOID(fp_taos_free_result);
377,025!
376
  return (*fp_taos_free_result)(res);
377,025✔
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) {
3,389,940✔
385
  CHECK_INT(fp_taos_field_count);
3,389,940!
386
  return (*fp_taos_field_count)(res);
3,389,940✔
387
}
388

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

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

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

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

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

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

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

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

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

434
bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col) {
129,710,145✔
435
  CHECK_BOOL(fp_taos_is_null);
129,710,145!
436
  return (*fp_taos_is_null)(res, row, col);
129,710,145✔
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) {
138,267✔
445
  CHECK_BOOL(fp_taos_is_update_query);
138,267!
446
  return (*fp_taos_is_update_query)(res);
138,267✔
447
}
448

449
int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
80,109✔
450
  CHECK_INT(fp_taos_fetch_block);
80,109!
451
  return (*fp_taos_fetch_block)(res, rows);
80,109✔
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) {
20,238✔
460
  CHECK_INT(fp_taos_fetch_raw_block);
20,238!
461
  return (*fp_taos_fetch_raw_block)(res, numOfRows, pData);
20,238✔
462
}
463

464
int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex) {
75,024✔
465
  CHECK_PTR(fp_taos_get_column_data_offset);
75,024!
466
  return (*fp_taos_get_column_data_offset)(res, columnIndex);
75,024✔
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) {
3,067,755✔
480
  CHECK_PTR(fp_taos_fetch_lengths);
3,067,755!
481
  return (*fp_taos_fetch_lengths)(res);
3,067,755✔
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) {
240✔
490
  CHECK_PTR(fp_taos_get_server_info);
240!
491
  return (*fp_taos_get_server_info)(taos);
240✔
492
}
493

494
const char *taos_get_client_info() {
1,641✔
495
  if (fp_taos_get_client_info == NULL) {
1,641✔
496
    return td_version;
1,215✔
497
  } else {
498
    return (*fp_taos_get_client_info)();
426✔
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) {
810✔
508
  (void)taos_init();
810✔
509
  if (fp_taos_errstr == NULL) {
810!
510
    return tstrerror(terrno);
×
511
  }
512
  return (*fp_taos_errstr)(res);
810✔
513
}
514

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

523
void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param) {
213✔
524
  CHECK_VOID(fp_taos_query_a);
213!
525
  (*fp_taos_query_a)(taos, sql, fp, param);
213✔
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) {
14,391✔
534
  CHECK_VOID(fp_taos_fetch_rows_a);
14,391!
535
  (*fp_taos_fetch_rows_a)(res, fp, param);
14,391✔
536
}
537

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

543
const void *taos_get_raw_block(TAOS_RES *res) {
15✔
544
  CHECK_PTR(fp_taos_get_raw_block);
15!
545
  return (*fp_taos_get_raw_block)(res);
15✔
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) {
417✔
569
  if (taos_init() != 0) {
417!
570
    return;
×
571
  }
572

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

577
int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param, int type) {
210✔
578
  CHECK_INT(fp_taos_set_notify_cb);
210!
579
  return (*fp_taos_set_notify_cb)(taos, fp, param, type);
210✔
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) {
3✔
588
  CHECK_INT(fp_taos_set_conn_mode);
3!
589
  return (*fp_taos_set_conn_mode)(taos, mode, value);
3✔
590
}
591

592
TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision) {
732✔
593
  CHECK_PTR(fp_taos_schemaless_insert);
732!
594
  return (*fp_taos_schemaless_insert)(taos, lines, numLines, protocol, precision);
732✔
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,
705✔
622
                                                int32_t ttl, int64_t reqid) {
623
  CHECK_PTR(fp_taos_schemaless_insert_ttl_with_reqid);
705!
624
  return (*fp_taos_schemaless_insert_ttl_with_reqid)(taos, lines, numLines, protocol, precision, ttl, reqid);
705✔
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,
24✔
634
                                                    int precision, int32_t ttl, int64_t reqid) {
635
  CHECK_PTR(fp_taos_schemaless_insert_raw_ttl_with_reqid);
24!
636
  return (*fp_taos_schemaless_insert_raw_ttl_with_reqid)(taos, lines, len, totalRows, protocol, precision, ttl, reqid);
24✔
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,
705✔
648
                                                           int precision, int32_t ttl, int64_t reqid, char *tbnameKey) {
649
  CHECK_PTR(fp_taos_schemaless_insert_ttl_with_reqid_tbname_key);
705!
650
  return (*fp_taos_schemaless_insert_ttl_with_reqid_tbname_key)(taos, lines, numLines, protocol, precision, ttl, reqid,
705✔
651
                                                                tbnameKey);
652
}
653

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

732
int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg) {
312✔
733
  CHECK_INT(fp_tmq_commit_sync);
312!
734
  return (*fp_tmq_commit_sync)(tmq, msg);
312✔
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) {
3✔
743
  CHECK_INT(fp_tmq_commit_offset_sync);
3!
744
  return (*fp_tmq_commit_offset_sync)(tmq, pTopicName, vgId, offset);
3✔
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,
24✔
754
                                 int32_t *numOfAssignment) {
755
  CHECK_INT(fp_tmq_get_topic_assignment);
24!
756
  return (*fp_tmq_get_topic_assignment)(tmq, pTopicName, assignment, numOfAssignment);
24✔
757
}
758

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

764
int32_t tmq_offset_seek(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset) {
30✔
765
  CHECK_INT(fp_tmq_offset_seek);
30!
766
  return (*fp_tmq_offset_seek)(tmq, pTopicName, vgId, offset);
30✔
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) {
64,215✔
785
  CHECK_PTR(fp_tmq_get_table_name);
64,215!
786
  return (*fp_tmq_get_table_name)(res);
64,215✔
787
}
788

789
tmq_res_t tmq_get_res_type(TAOS_RES *res) {
1,767✔
790
  CHECK_INT(fp_tmq_get_res_type);
1,767!
791
  return (*fp_tmq_get_res_type)(res);
1,767✔
792
}
793

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

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

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

809
int64_t tmq_get_vgroup_offset(TAOS_RES *res) {
1,530✔
810
  CHECK_INT(fp_tmq_get_vgroup_offset);
1,530!
811
  return (*fp_tmq_get_vgroup_offset)(res);
1,530✔
812
}
813

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

819
int32_t tmq_get_raw(TAOS_RES *res, tmq_raw_data *raw) {
18✔
820
  CHECK_INT(fp_tmq_get_raw);
18!
821
  return (*fp_tmq_get_raw)(res, raw);
18✔
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) {
3✔
867
  CHECK_INT(fp_taos_check_server_status);
3!
868
  return (*fp_taos_check_server_status)(fqdn, port, details, maxlen);
3✔
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