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

taosdata / TDengine / #3840

04 Apr 2025 03:35PM UTC coverage: 63.027% (+0.6%) from 62.382%
#3840

push

travis-ci

web-flow
Merge pull request #30653 from taosdata/merge/mainto3.0

merge: from main to 3.0 branch

155471 of 315065 branches covered (49.35%)

Branch coverage included in aggregate %.

241637 of 314991 relevant lines covered (76.71%)

18825079.96 hits per line

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

48.34
/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) {
15,826✔
96
  tsDriverOnceRet = taosDriverInit(tsDriverType);
15,826✔
97
  if (tsDriverOnceRet != 0) return;
15,826!
98

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

110
int taos_init(void) {
12,280,309✔
111
  (void)taosThreadOnce(&tsDriverOnce, taos_init_driver);
12,280,309✔
112
  (void)taosThreadOnce(&tsInitOnce, taos_init_wrapper);
12,282,495✔
113
  return tsInitOnceRet;
12,281,052✔
114
}
115

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

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

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

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

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

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

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

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

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

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

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

203
int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name) {
91,014✔
204
  CHECK_INT(fp_taos_stmt_set_tbname);
91,014!
205
  return (*fp_taos_stmt_set_tbname)(stmt, name);
91,014✔
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) {
151✔
224
  CHECK_INT(fp_taos_stmt_get_col_fields);
151!
225
  return (*fp_taos_stmt_get_col_fields)(stmt, fieldNum, fields);
151✔
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) {
6✔
234
  CHECK_INT(fp_taos_stmt_is_insert);
6!
235
  return (*fp_taos_stmt_is_insert)(stmt, insert);
6✔
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) {
902✔
244
  CHECK_INT(fp_taos_stmt_get_param);
902!
245
  return (*fp_taos_stmt_get_param)(stmt, idx, type, bytes);
902✔
246
}
247

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

253
int taos_stmt_bind_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) {
1,103,040✔
254
  CHECK_INT(fp_taos_stmt_bind_param_batch);
1,103,040!
255
  return (*fp_taos_stmt_bind_param_batch)(stmt, bind);
1,103,040✔
256
}
257

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

263
int taos_stmt_add_batch(TAOS_STMT *stmt) {
1,042,215✔
264
  CHECK_INT(fp_taos_stmt_add_batch);
1,042,215!
265
  return (*fp_taos_stmt_add_batch)(stmt);
1,042,215✔
266
}
267

268
int taos_stmt_execute(TAOS_STMT *stmt) {
55,329✔
269
  CHECK_INT(fp_taos_stmt_execute);
55,329!
270
  return (*fp_taos_stmt_execute)(stmt);
55,329✔
271
}
272

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

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

283
char *taos_stmt_errstr(TAOS_STMT *stmt) {
6✔
284
  CHECK_PTR(fp_taos_stmt_errstr);
6!
285
  return (*fp_taos_stmt_errstr)(stmt);
6✔
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) {
×
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) {
72✔
299
  CHECK_PTR(fp_taos_stmt2_init);
72!
300
  return (*fp_taos_stmt2_init)(taos, option);
72✔
301
}
302

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

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

324
int taos_stmt2_close(TAOS_STMT2 *stmt) {
72✔
325
  CHECK_INT(fp_taos_stmt2_close);
72!
326
  return (*fp_taos_stmt2_close)(stmt);
72✔
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) {
10,484,207✔
355
  CHECK_PTR(fp_taos_query);
10,484,207!
356
  return (*fp_taos_query)(taos, sql);
10,484,207✔
357
}
358

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

434
bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col) {
318,622,973✔
435
  CHECK_BOOL(fp_taos_is_null);
318,622,973!
436
  return (*fp_taos_is_null)(res, row, col);
318,622,973✔
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) {
1,318,908✔
450
  CHECK_INT(fp_taos_fetch_block);
1,318,908!
451
  return (*fp_taos_fetch_block)(res, rows);
1,318,908✔
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) {
530,494✔
465
  CHECK_PTR(fp_taos_get_column_data_offset);
530,494!
466
  return (*fp_taos_get_column_data_offset)(res, columnIndex);
530,494✔
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) {
15,845,027✔
480
  CHECK_PTR(fp_taos_fetch_lengths);
15,845,027!
481
  return (*fp_taos_fetch_lengths)(res);
15,845,027✔
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) {
168✔
490
  CHECK_PTR(fp_taos_get_server_info);
168!
491
  return (*fp_taos_get_server_info)(taos);
168✔
492
}
493

494
const char *taos_get_client_info() {
16,794✔
495
  if (fp_taos_get_client_info == NULL) {
16,794✔
496
    return td_version;
2,382✔
497
  } else {
498
    return (*fp_taos_get_client_info)();
14,412✔
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) {
88,827✔
508
  (void)taos_init();
88,827✔
509
  if (fp_taos_errstr == NULL) {
88,827!
510
    return tstrerror(terrno);
×
511
  }
512
  return (*fp_taos_errstr)(res);
88,827✔
513
}
514

515
int taos_errno(TAOS_RES *res) {
12,107,819✔
516
  (void)taos_init();
12,107,819✔
517
  if (fp_taos_errno == NULL) {
12,107,945!
518
    return terrno;
×
519
  }
520
  return (*fp_taos_errno)(res);
12,107,945✔
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) {
400,285✔
534
  CHECK_VOID(fp_taos_fetch_rows_a);
400,285!
535
  (*fp_taos_fetch_rows_a)(res, fp, param);
400,285✔
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) {
2✔
549
  CHECK_INT(fp_taos_get_db_route_info);
2!
550
  return (*fp_taos_get_db_route_info)(taos, db, dbInfo);
2✔
551
}
552

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

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

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

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

573
  CHECK_VOID(fp_taos_set_hb_quit);
14,418!
574
  return (*fp_taos_set_hb_quit)(quitByKill);
14,418✔
575
}
576

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

774
int64_t tmq_committed(tmq_t *tmq, const char *pTopicName, int32_t vgId) {
14✔
775
  CHECK_INT(fp_tmq_committed);
14!
776
  return (*fp_tmq_committed)(tmq, pTopicName, vgId);
14✔
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) {
280,009✔
785
  CHECK_PTR(fp_tmq_get_table_name);
280,009!
786
  return (*fp_tmq_get_table_name)(res);
280,009✔
787
}
788

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

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

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

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

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

814
const char *tmq_err2str(int32_t code) {
24✔
815
  CHECK_PTR(fp_tmq_err2str);
24!
816
  return (*fp_tmq_err2str)(code);
24✔
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) {
6✔
867
  CHECK_INT(fp_taos_check_server_status);
6!
868
  return (*fp_taos_check_server_status)(fqdn, port, details, maxlen);
6✔
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