From e8ce5a1000a4e6bd2e627c77f45536b787f95589 Mon Sep 17 00:00:00 2001 From: kailixu Date: Sun, 2 Jul 2023 23:03:13 +0800 Subject: [PATCH] chore: code optimization --- tests/script/api/passwdTest.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/tests/script/api/passwdTest.c b/tests/script/api/passwdTest.c index f181f57f3d..1cc0072dc7 100644 --- a/tests/script/api/passwdTest.c +++ b/tests/script/api/passwdTest.c @@ -113,47 +113,37 @@ int printRow(char *str, TAOS_ROW row, TAOS_FIELD *fields, int numFields) { case TSDB_DATA_TYPE_TINYINT: len += sprintf(str + len, "%d", *((int8_t *)row[i])); break; - case TSDB_DATA_TYPE_UTINYINT: len += sprintf(str + len, "%u", *((uint8_t *)row[i])); break; - case TSDB_DATA_TYPE_SMALLINT: len += sprintf(str + len, "%d", *((int16_t *)row[i])); break; - case TSDB_DATA_TYPE_USMALLINT: len += sprintf(str + len, "%u", *((uint16_t *)row[i])); break; - case TSDB_DATA_TYPE_INT: len += sprintf(str + len, "%d", *((int32_t *)row[i])); break; - case TSDB_DATA_TYPE_UINT: len += sprintf(str + len, "%u", *((uint32_t *)row[i])); break; - case TSDB_DATA_TYPE_BIGINT: len += sprintf(str + len, "%" PRId64, *((int64_t *)row[i])); break; - case TSDB_DATA_TYPE_UBIGINT: len += sprintf(str + len, "%" PRIu64, *((uint64_t *)row[i])); break; - case TSDB_DATA_TYPE_FLOAT: { float fv = 0; fv = GET_FLOAT_VAL(row[i]); len += sprintf(str + len, "%f", fv); } break; - case TSDB_DATA_TYPE_DOUBLE: { double dv = 0; dv = GET_DOUBLE_VAL(row[i]); len += sprintf(str + len, "%lf", dv); } break; - case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { @@ -161,18 +151,15 @@ int printRow(char *str, TAOS_ROW row, TAOS_FIELD *fields, int numFields) { memcpy(str + len, row[i], charLen); len += charLen; } break; - case TSDB_DATA_TYPE_TIMESTAMP: len += sprintf(str + len, "%" PRId64, *((int64_t *)row[i])); break; - case TSDB_DATA_TYPE_BOOL: len += sprintf(str + len, "%d", *((int8_t *)row[i])); default: break; } } - return len; } @@ -376,20 +363,6 @@ _REP: sleep(1); } - res = taos_query(taos[0], qstr); - int32_t code = taos_errno(res); - if (code != 0) { - fprintf(stderr, "%s:%d failed to execute: %s since %s\n", __func__, __LINE__, qstr, taos_errstr(res)); - taos_free_result(res); - exit(EXIT_FAILURE); - } - printResult(res, output); - taos_free_result(res); - if (!strstr(output, "timeseries")) { - fprintf(stderr, "%s:%d expected output: 'timeseries' not occur\n", __func__, __LINE__); - exit(EXIT_FAILURE); - } - if(++nRep < 5) { goto _REP; } -- GitLab