commit
f65bb570cc
|
@ -808,27 +808,31 @@ void *readMetric(void *sarg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void queryDB(TAOS *taos, char *command) {
|
void queryDB(TAOS *taos, char *command) {
|
||||||
int i = 5;
|
int i;
|
||||||
TAOS_RES *pSql = NULL;
|
TAOS_RES *pSql = NULL;
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
while (i > 0 && code != 0) {
|
|
||||||
|
for (i = 0; i < 5; i++) {
|
||||||
|
if (NULL != pSql) {
|
||||||
|
taos_free_result(pSql);
|
||||||
|
pSql = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
pSql = taos_query(taos, command);
|
pSql = taos_query(taos, command);
|
||||||
code = taos_errno(pSql);
|
code = taos_errno(pSql);
|
||||||
taos_free_result(pSql);
|
if (0 == code) {
|
||||||
pSql = NULL;
|
|
||||||
if (code == 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
fprintf(stderr, "Failed to run %s, reason: %s\n", command, taos_errstr(pSql));
|
fprintf(stderr, "Failed to run %s, reason: %s\n", command, taos_errstr(pSql));
|
||||||
taos_free_result(pSql);
|
taos_free_result(pSql);
|
||||||
|
|
||||||
taos_close(taos);
|
taos_close(taos);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taos_free_result(pSql);
|
||||||
}
|
}
|
||||||
|
|
||||||
// sync insertion
|
// sync insertion
|
||||||
|
|
Loading…
Reference in New Issue