This commit is contained in:
liu0x54 2020-06-16 10:10:49 +00:00
commit 9e24388528
35 changed files with 669 additions and 548 deletions

View File

@ -132,14 +132,14 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
for (int32_t i = 0; i < numOfRows; ++i) { for (int32_t i = 0; i < numOfRows; ++i) {
TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 0); TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 0);
char* dst = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 0) * totalNumOfRows + pField->bytes * i; char* dst = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 0) * totalNumOfRows + pField->bytes * i;
STR_WITH_MAXSIZE_TO_VARSTR(dst, pSchema[i].name, TSDB_COL_NAME_LEN - 1); STR_WITH_MAXSIZE_TO_VARSTR(dst, pSchema[i].name, pField->bytes);
char *type = tDataTypeDesc[pSchema[i].type].aName; char *type = tDataTypeDesc[pSchema[i].type].aName;
pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 1); pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 1);
dst = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 1) * totalNumOfRows + pField->bytes * i; dst = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 1) * totalNumOfRows + pField->bytes * i;
STR_TO_VARSTR(dst, type); STR_WITH_MAXSIZE_TO_VARSTR(dst, type, pField->bytes);
int32_t bytes = pSchema[i].bytes; int32_t bytes = pSchema[i].bytes;
if (pSchema[i].type == TSDB_DATA_TYPE_BINARY || pSchema[i].type == TSDB_DATA_TYPE_NCHAR) { if (pSchema[i].type == TSDB_DATA_TYPE_BINARY || pSchema[i].type == TSDB_DATA_TYPE_NCHAR) {
@ -157,7 +157,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
if (i >= tscGetNumOfColumns(pMeta) && tscGetNumOfTags(pMeta) != 0) { if (i >= tscGetNumOfColumns(pMeta) && tscGetNumOfTags(pMeta) != 0) {
char* output = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i; char* output = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i;
const char *src = "TAG"; const char *src = "TAG";
STR_WITH_SIZE_TO_VARSTR(output, src, strlen(src)); STR_WITH_MAXSIZE_TO_VARSTR(output, src, pField->bytes);
} }
} }
@ -171,7 +171,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
// field name // field name
TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 0); TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 0);
char* output = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 0) * totalNumOfRows + pField->bytes * i; char* output = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 0) * totalNumOfRows + pField->bytes * i;
STR_WITH_MAXSIZE_TO_VARSTR(output, pSchema[i].name, TSDB_COL_NAME_LEN - 1); STR_WITH_MAXSIZE_TO_VARSTR(output, pSchema[i].name, pField->bytes);
// type name // type name
pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 1); pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 1);
@ -193,7 +193,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3); pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3);
char *target = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i; char *target = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i;
const char *src = "TAG"; const char *src = "TAG";
STR_WITH_SIZE_TO_VARSTR(target, src, strlen(src)); STR_WITH_MAXSIZE_TO_VARSTR(target, src, pField->bytes);
pTagValue += pSchema[i].bytes; pTagValue += pSchema[i].bytes;
} }
@ -220,15 +220,15 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
rowLen += ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE); rowLen += ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE);
f.bytes = typeColLength; f.bytes = typeColLength + VARSTR_HEADER_SIZE;
f.type = TSDB_DATA_TYPE_BINARY; f.type = TSDB_DATA_TYPE_BINARY;
tstrncpy(f.name, "Type", sizeof(f.name)); tstrncpy(f.name, "Type", sizeof(f.name));
pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, TSDB_DATA_TYPE_BINARY, typeColLength, pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, TSDB_DATA_TYPE_BINARY, typeColLength + VARSTR_HEADER_SIZE,
typeColLength, false); typeColLength, false);
rowLen += typeColLength; rowLen += typeColLength + VARSTR_HEADER_SIZE;
f.bytes = sizeof(int32_t); f.bytes = sizeof(int32_t);
f.type = TSDB_DATA_TYPE_INT; f.type = TSDB_DATA_TYPE_INT;
@ -240,15 +240,15 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
rowLen += sizeof(int32_t); rowLen += sizeof(int32_t);
f.bytes = noteColLength; f.bytes = noteColLength + VARSTR_HEADER_SIZE;
f.type = TSDB_DATA_TYPE_BINARY; f.type = TSDB_DATA_TYPE_BINARY;
tstrncpy(f.name, "Note", sizeof(f.name)); tstrncpy(f.name, "Note", sizeof(f.name));
pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, TSDB_DATA_TYPE_BINARY, noteColLength, pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, TSDB_DATA_TYPE_BINARY, noteColLength + VARSTR_HEADER_SIZE,
noteColLength, false); noteColLength, false);
rowLen += noteColLength; rowLen += noteColLength + VARSTR_HEADER_SIZE;
return rowLen; return rowLen;
} }

View File

@ -24,19 +24,19 @@ TEST(testCase, parse_time) {
int64_t time = 0, time1 = 0; int64_t time = 0, time1 = 0;
taosParseTime(t1, &time, strlen(t1), TSDB_TIME_PRECISION_MILLI); taosParseTime(t1, &time, strlen(t1), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 1514739661952); EXPECT_EQ(time, 1514739661952);
taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, timezone * MILLISECOND_PER_SECOND); EXPECT_EQ(time, timezone * MILLISECOND_PER_SECOND);
char t2[] = "2018-1-1T1:1:1.952Z"; char t2[] = "2018-1-1T1:1:1.952Z";
taosParseTime(t2, &time, strlen(t2), TSDB_TIME_PRECISION_MILLI); taosParseTime(t2, &time, strlen(t2), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 1514739661952 + 28800000); EXPECT_EQ(time, 1514739661952 + 28800000);
char t3[] = "2018-1-1 1:01:01.952"; char t3[] = "2018-1-1 1:01:01.952";
taosParseTime(t3, &time, strlen(t3), TSDB_TIME_PRECISION_MILLI); taosParseTime(t3, &time, strlen(t3), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 1514739661952); EXPECT_EQ(time, 1514739661952);
char t4[] = "2018-1-1 1:01:01.9"; char t4[] = "2018-1-1 1:01:01.9";
@ -45,122 +45,122 @@ TEST(testCase, parse_time) {
char t7[] = "2018-01-01 01:01:01.9"; char t7[] = "2018-01-01 01:01:01.9";
char t8[] = "2018-01-01 01:01:01.9007865"; char t8[] = "2018-01-01 01:01:01.9007865";
taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI); taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t5, &time1, strlen(t5), TSDB_TIME_PRECISION_MILLI); taosParseTime(t5, &time1, strlen(t5), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI); taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t6, &time1, strlen(t6), TSDB_TIME_PRECISION_MILLI); taosParseTime(t6, &time1, strlen(t6), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI); taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t7, &time1, strlen(t7), TSDB_TIME_PRECISION_MILLI); taosParseTime(t7, &time1, strlen(t7), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
taosParseTime(t5, &time, strlen(t5), TSDB_TIME_PRECISION_MILLI); taosParseTime(t5, &time, strlen(t5), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t8, &time1, strlen(t8), TSDB_TIME_PRECISION_MILLI); taosParseTime(t8, &time1, strlen(t8), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
char t9[] = "2017-4-3 1:1:2.980"; char t9[] = "2017-4-3 1:1:2.980";
char t10[] = "2017-4-3T2:1:2.98+9:00"; char t10[] = "2017-4-3T2:1:2.98+9:00";
taosParseTime(t9, &time, strlen(t9), TSDB_TIME_PRECISION_MILLI); taosParseTime(t9, &time, strlen(t9), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI); taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
char t11[] = "2017-4-3T2:1:2.98+09:00"; char t11[] = "2017-4-3T2:1:2.98+09:00";
taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI); taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI); taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
char t12[] = "2017-4-3T2:1:2.98+0900"; char t12[] = "2017-4-3T2:1:2.98+0900";
taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI); taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t12, &time1, strlen(t12), TSDB_TIME_PRECISION_MILLI); taosParseTime(t12, &time1, strlen(t12), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
taos_options(TSDB_OPTION_TIMEZONE, "UTC"); taos_options(TSDB_OPTION_TIMEZONE, "UTC");
deltaToUtcInitOnce(); deltaToUtcInitOnce();
taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 0); EXPECT_EQ(time, 0);
taos_options(TSDB_OPTION_TIMEZONE, "Asia/Shanghai"); taos_options(TSDB_OPTION_TIMEZONE, "Asia/Shanghai");
deltaToUtcInitOnce(); deltaToUtcInitOnce();
char t14[] = "1970-1-1T0:0:0Z"; char t14[] = "1970-1-1T0:0:0Z";
taosParseTime(t14, &time, strlen(t14), TSDB_TIME_PRECISION_MILLI); taosParseTime(t14, &time, strlen(t14), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 0); EXPECT_EQ(time, 0);
char t40[] = "1970-1-1 0:0:0.999999999"; char t40[] = "1970-1-1 0:0:0.999999999";
taosParseTime(t40, &time, strlen(t40), TSDB_TIME_PRECISION_MILLI); taosParseTime(t40, &time, strlen(t40), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 999 + timezone * MILLISECOND_PER_SECOND); EXPECT_EQ(time, 999 + timezone * MILLISECOND_PER_SECOND);
char t41[] = "1997-1-1 0:0:0.999999999"; char t41[] = "1997-1-1 0:0:0.999999999";
taosParseTime(t41, &time, strlen(t41), TSDB_TIME_PRECISION_MILLI); taosParseTime(t41, &time, strlen(t41), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 852048000999); EXPECT_EQ(time, 852048000999);
int64_t k = timezone; int64_t k = timezone;
char t42[] = "1997-1-1T0:0:0.999999999Z"; char t42[] = "1997-1-1T0:0:0.999999999Z";
taosParseTime(t42, &time, strlen(t42), TSDB_TIME_PRECISION_MILLI); taosParseTime(t42, &time, strlen(t42), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 852048000999 - timezone * MILLISECOND_PER_SECOND); EXPECT_EQ(time, 852048000999 - timezone * MILLISECOND_PER_SECOND);
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// illegal timestamp format // illegal timestamp format
char t15[] = "2017-12-33 0:0:0"; char t15[] = "2017-12-33 0:0:0";
EXPECT_EQ(taosParseTime(t15, &time, strlen(t15), TSDB_TIME_PRECISION_MILLI), -1); EXPECT_EQ(taosParseTime(t15, &time, strlen(t15), TSDB_TIME_PRECISION_MILLI, 0), -1);
char t16[] = "2017-12-31 99:0:0"; char t16[] = "2017-12-31 99:0:0";
EXPECT_EQ(taosParseTime(t16, &time, strlen(t16), TSDB_TIME_PRECISION_MILLI), -1); EXPECT_EQ(taosParseTime(t16, &time, strlen(t16), TSDB_TIME_PRECISION_MILLI, 0), -1);
char t17[] = "2017-12-31T9:0:0"; char t17[] = "2017-12-31T9:0:0";
EXPECT_EQ(taosParseTime(t17, &time, strlen(t17), TSDB_TIME_PRECISION_MILLI), -1); EXPECT_EQ(taosParseTime(t17, &time, strlen(t17), TSDB_TIME_PRECISION_MILLI, 0), -1);
char t18[] = "2017-12-31T9:0:0.Z"; char t18[] = "2017-12-31T9:0:0.Z";
EXPECT_EQ(taosParseTime(t18, &time, strlen(t18), TSDB_TIME_PRECISION_MILLI), -1); EXPECT_EQ(taosParseTime(t18, &time, strlen(t18), TSDB_TIME_PRECISION_MILLI, 0), -1);
char t19[] = "2017-12-31 9:0:0.-1"; char t19[] = "2017-12-31 9:0:0.-1";
EXPECT_EQ(taosParseTime(t19, &time, strlen(t19), TSDB_TIME_PRECISION_MILLI), -1); EXPECT_EQ(taosParseTime(t19, &time, strlen(t19), TSDB_TIME_PRECISION_MILLI, 0), -1);
char t20[] = "2017-12-31 9:0:0.1+12:99"; char t20[] = "2017-12-31 9:0:0.1+12:99";
EXPECT_EQ(taosParseTime(t20, &time, strlen(t20), TSDB_TIME_PRECISION_MILLI), 0); EXPECT_EQ(taosParseTime(t20, &time, strlen(t20), TSDB_TIME_PRECISION_MILLI, 0), 0);
EXPECT_EQ(time, 1514682000100); EXPECT_EQ(time, 1514682000100);
char t21[] = "2017-12-31T9:0:0.1+12:99"; char t21[] = "2017-12-31T9:0:0.1+12:99";
EXPECT_EQ(taosParseTime(t21, &time, strlen(t21), TSDB_TIME_PRECISION_MILLI), -1); EXPECT_EQ(taosParseTime(t21, &time, strlen(t21), TSDB_TIME_PRECISION_MILLI, 0), -1);
char t22[] = "2017-12-31 9:0:0.1+13:1"; char t22[] = "2017-12-31 9:0:0.1+13:1";
EXPECT_EQ(taosParseTime(t22, &time, strlen(t22), TSDB_TIME_PRECISION_MILLI), 0); EXPECT_EQ(taosParseTime(t22, &time, strlen(t22), TSDB_TIME_PRECISION_MILLI, 0), 0);
char t23[] = "2017-12-31T9:0:0.1+13:1"; char t23[] = "2017-12-31T9:0:0.1+13:1";
EXPECT_EQ(taosParseTime(t23, &time, strlen(t23), TSDB_TIME_PRECISION_MILLI), 0); EXPECT_EQ(taosParseTime(t23, &time, strlen(t23), TSDB_TIME_PRECISION_MILLI, 0), 0);
//======================== add some case ============================// //======================== add some case ============================//
char b1[] = "9999-12-31 23:59:59.999"; char b1[] = "9999-12-31 23:59:59.999";
taosParseTime(b1, &time, strlen(b1), TSDB_TIME_PRECISION_MILLI); taosParseTime(b1, &time, strlen(b1), TSDB_TIME_PRECISION_MILLI,0);
EXPECT_EQ(time, 253402271999999); EXPECT_EQ(time, 253402271999999);
char b2[] = "2020-01-01 01:01:01.321"; char b2[] = "2020-01-01 01:01:01.321";
taosParseTime(b2, &time, strlen(b2), TSDB_TIME_PRECISION_MILLI); taosParseTime(b2, &time, strlen(b2), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 1577811661321); EXPECT_EQ(time, 1577811661321);
taos_options(TSDB_OPTION_TIMEZONE, "America/New_York"); taos_options(TSDB_OPTION_TIMEZONE, "America/New_York");
deltaToUtcInitOnce(); deltaToUtcInitOnce();
taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 18000 * MILLISECOND_PER_SECOND); EXPECT_EQ(time, 18000 * MILLISECOND_PER_SECOND);
taos_options(TSDB_OPTION_TIMEZONE, "Asia/Tokyo"); taos_options(TSDB_OPTION_TIMEZONE, "Asia/Tokyo");
deltaToUtcInitOnce(); deltaToUtcInitOnce();
taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, -32400 * MILLISECOND_PER_SECOND); EXPECT_EQ(time, -32400 * MILLISECOND_PER_SECOND);
taos_options(TSDB_OPTION_TIMEZONE, "Asia/Shanghai"); taos_options(TSDB_OPTION_TIMEZONE, "Asia/Shanghai");
deltaToUtcInitOnce(); deltaToUtcInitOnce();
taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, -28800 * MILLISECOND_PER_SECOND); EXPECT_EQ(time, -28800 * MILLISECOND_PER_SECOND);
} }

View File

@ -36,7 +36,7 @@ extern "C" {
#define STR_WITH_MAXSIZE_TO_VARSTR(x, str, _maxs) \ #define STR_WITH_MAXSIZE_TO_VARSTR(x, str, _maxs) \
do { \ do { \
char *_e = stpncpy(varDataVal(x), (str), (_maxs)); \ char *_e = stpncpy(varDataVal(x), (str), (_maxs)-VARSTR_HEADER_SIZE); \
varDataSetLen(x, (_e - (x)-VARSTR_HEADER_SIZE)); \ varDataSetLen(x, (_e - (x)-VARSTR_HEADER_SIZE)); \
} while (0) } while (0)

View File

@ -613,7 +613,7 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
char* name = mnodeGetDbStr(pDb->name); char* name = mnodeGetDbStr(pDb->name);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, name, TSDB_DB_NAME_LEN - 1); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, name, pShow->bytes[cols]);
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;

View File

@ -593,7 +593,7 @@ static int32_t mnodeRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, vo
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols] - VARSTR_HEADER_SIZE); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols]);
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;

View File

@ -401,9 +401,9 @@ static int32_t mnodeRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, vo
SDnodeObj *pDnode = mnodeGetDnode(pMnode->mnodeId); SDnodeObj *pDnode = mnodeGetDnode(pMnode->mnodeId);
if (pDnode != NULL) { if (pDnode != NULL) {
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols] - VARSTR_HEADER_SIZE); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols]);
} else { } else {
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, "invalid ep", pShow->bytes[cols] - VARSTR_HEADER_SIZE); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, "invalid ep", pShow->bytes[cols]);
} }
mnodeDecDnodeRef(pDnode); mnodeDecDnodeRef(pDnode);
@ -411,7 +411,7 @@ static int32_t mnodeRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, vo
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
char* roles = mnodeGetMnodeRoleStr(pMnode->role); char* roles = mnodeGetMnodeRoleStr(pMnode->role);
STR_TO_VARSTR(pWrite, roles); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, roles, pShow->bytes[cols]);
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;

View File

@ -2103,7 +2103,7 @@ static int32_t mnodeGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void
cols++; cols++;
SSchema tbCol = tGetTableNameColumnSchema(); SSchema tbCol = tGetTableNameColumnSchema();
pShow->bytes[cols] = tbCol.bytes; pShow->bytes[cols] = tbCol.bytes + VARSTR_HEADER_SIZE;
pSchema[cols].type = tbCol.type; pSchema[cols].type = tbCol.type;
strcpy(pSchema[cols].name, "stable_name"); strcpy(pSchema[cols].name, "stable_name");
pSchema[cols].bytes = htons(pShow->bytes[cols]); pSchema[cols].bytes = htons(pShow->bytes[cols]);
@ -2161,7 +2161,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
char *pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; char *pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, sizeof(tableName) - 1); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, pShow->bytes[cols]);
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
@ -2182,7 +2182,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
memset(tableName, 0, sizeof(tableName)); memset(tableName, 0, sizeof(tableName));
if (pTable->info.type == TSDB_CHILD_TABLE) { if (pTable->info.type == TSDB_CHILD_TABLE) {
mnodeExtractTableName(pTable->superTable->info.tableId, tableName); mnodeExtractTableName(pTable->superTable->info.tableId, tableName);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, sizeof(tableName) - 1); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, pShow->bytes[cols]);
} }
cols++; cols++;
@ -2352,7 +2352,7 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro
char *pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; char *pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, sizeof(tableName) - 1); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, pShow->bytes[cols]);
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
@ -2364,7 +2364,7 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pTable->sql, TSDB_MAX_SQL_SHOW_LEN); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pTable->sql, pShow->bytes[cols]);
cols++; cols++;
numOfRows++; numOfRows++;

View File

@ -315,8 +315,7 @@ static int32_t mnodeRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, voi
cols = 0; cols = 0;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
size_t size = sizeof(pUser->user); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->user, pShow->bytes[cols]);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->user, size);
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
@ -337,7 +336,7 @@ static int32_t mnodeRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, voi
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->acct, sizeof(pUser->user)); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->acct, pShow->bytes[cols]);
cols++; cols++;
numOfRows++; numOfRows++;

View File

@ -479,12 +479,12 @@ int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pC
if (pDnode != NULL) { if (pDnode != NULL) {
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols] - VARSTR_HEADER_SIZE); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols]);
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
char *role = mnodeGetMnodeRoleStr(pVgroup->vnodeGid[i].role); char *role = mnodeGetMnodeRoleStr(pVgroup->vnodeGid[i].role);
STR_TO_VARSTR(pWrite, role); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, role, pShow->bytes[cols]);
cols++; cols++;
} else { } else {
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;

View File

@ -847,7 +847,7 @@ static void blockwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *
} }
int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order); int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order);
if (isIntervalQuery(pQuery)) { if (isIntervalQuery(pQuery) && tsCols != NULL) {
int32_t offset = GET_COL_DATA_POS(pQuery, 0, step); int32_t offset = GET_COL_DATA_POS(pQuery, 0, step);
TSKEY ts = tsCols[offset]; TSKEY ts = tsCols[offset];
@ -4263,7 +4263,8 @@ static void sequentialTableProcess(SQInfo *pQInfo) {
assert(taosArrayGetSize(s) >= 1); assert(taosArrayGetSize(s) >= 1);
setTagVal(pRuntimeEnv, (STableId*) taosArrayGet(s, 0), pQInfo->tsdb); setTagVal(pRuntimeEnv, (STableId*) taosArrayGet(s, 0), pQInfo->tsdb);
taosArrayDestroy(s);
if (isFirstLastRowQuery(pQuery)) { if (isFirstLastRowQuery(pQuery)) {
assert(taosArrayGetSize(s) == 1); assert(taosArrayGetSize(s) == 1);
} }
@ -4328,6 +4329,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) {
SWindowResInfo *pWindowResInfo = &pRuntimeEnv->windowResInfo; SWindowResInfo *pWindowResInfo = &pRuntimeEnv->windowResInfo;
// no results generated for current group, continue to try the next group // no results generated for current group, continue to try the next group
taosArrayDestroy(s);
if (pWindowResInfo->size <= 0) { if (pWindowResInfo->size <= 0) {
continue; continue;
} }

View File

@ -496,7 +496,6 @@ static int32_t setQueryCond(tQueryInfo *queryColInfo, SQueryCond* pCond) {
printf("relation is like\n"); printf("relation is like\n");
assert(0); assert(0);
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -511,7 +510,7 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr
if (cond.start != NULL) { if (cond.start != NULL) {
iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.start->v, pSkipList->keyInfo.type, TSDB_ORDER_ASC); iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.start->v, pSkipList->keyInfo.type, TSDB_ORDER_ASC);
} else { } else {
iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.end->v, pSkipList->keyInfo.type, TSDB_ORDER_DESC); iter = tSkipListCreateIterFromVal(pSkipList, (char*)(cond.end ? cond.end->v: NULL), pSkipList->keyInfo.type, TSDB_ORDER_DESC);
} }
if (cond.start != NULL) { if (cond.start != NULL) {
@ -601,6 +600,9 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr
} }
} }
} }
free(cond.start);
free(cond.end);
tSkipListDestroyIter(iter);
} }
int32_t merge(SArray *pLeft, SArray *pRight, SArray *pFinalRes) { int32_t merge(SArray *pLeft, SArray *pRight, SArray *pFinalRes) {
@ -748,6 +750,7 @@ static void exprTreeTraverseImpl(tExprNode *pExpr, SArray *pResult, SExprTravers
} }
taosArrayCopy(pResult, array); taosArrayCopy(pResult, array);
taosArrayDestroy(array);
} }
static void tSQLBinaryTraverseOnSkipList(tExprNode *pExpr, SArray *pResult, SSkipList *pSkipList, SExprTraverseSupp *param ) { static void tSQLBinaryTraverseOnSkipList(tExprNode *pExpr, SArray *pResult, SSkipList *pSkipList, SExprTraverseSupp *param ) {
@ -1182,4 +1185,4 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
CLEANUP_EXECUTE_TO(anchor, false); CLEANUP_EXECUTE_TO(anchor, false);
return expr; return expr;
} }

View File

@ -896,6 +896,7 @@ void tColModelDisplay(SColumnModel *pModel, void *pData, int32_t numOfRows, int3
char buf[4096] = {0}; char buf[4096] = {0};
taosUcs4ToMbs(val, pModel->pFields[j].field.bytes, buf); taosUcs4ToMbs(val, pModel->pFields[j].field.bytes, buf);
printf("%s\t", buf); printf("%s\t", buf);
break;
} }
case TSDB_DATA_TYPE_BINARY: { case TSDB_DATA_TYPE_BINARY: {
printBinaryData(val, pModel->pFields[j].field.bytes); printBinaryData(val, pModel->pFields[j].field.bytes);
@ -947,6 +948,7 @@ void tColModelDisplayEx(SColumnModel *pModel, void *pData, int32_t numOfRows, in
char buf[128] = {0}; char buf[128] = {0};
taosUcs4ToMbs(val, pModel->pFields[j].field.bytes, buf); taosUcs4ToMbs(val, pModel->pFields[j].field.bytes, buf);
printf("%s\t", buf); printf("%s\t", buf);
break;
} }
case TSDB_DATA_TYPE_BINARY: { case TSDB_DATA_TYPE_BINARY: {
printBinaryDataEx(val, pModel->pFields[j].field.bytes, &param[j]); printBinaryDataEx(val, pModel->pFields[j].field.bytes, &param[j]);

View File

@ -775,19 +775,14 @@ void setDCLSQLElems(SSqlInfo *pInfo, int32_t type, int32_t nParam, ...) {
while (nParam-- > 0) { while (nParam-- > 0) {
SSQLToken *pToken = va_arg(va, SSQLToken *); SSQLToken *pToken = va_arg(va, SSQLToken *);
(void)tTokenListAppend(pInfo->pDCLInfo, pToken); pInfo->pDCLInfo = tTokenListAppend(pInfo->pDCLInfo, pToken);
} }
va_end(va); va_end(va);
} }
void setDropDBTableInfo(SSqlInfo *pInfo, int32_t type, SSQLToken* pToken, SSQLToken* existsCheck) { void setDropDBTableInfo(SSqlInfo *pInfo, int32_t type, SSQLToken* pToken, SSQLToken* existsCheck) {
pInfo->type = type; pInfo->type = type;
pInfo->pDCLInfo = tTokenListAppend(pInfo->pDCLInfo, pToken);
if (pInfo->pDCLInfo == NULL) {
pInfo->pDCLInfo = calloc(1, sizeof(tDCLSQL));
}
tTokenListAppend(pInfo->pDCLInfo, pToken);
pInfo->pDCLInfo->existsCheck = (existsCheck->n == 1); pInfo->pDCLInfo->existsCheck = (existsCheck->n == 1);
} }

View File

@ -241,7 +241,6 @@ void tBucketDoubleHash(tMemBucket *pBucket, void *value, int16_t *segIdx, int16_
tMemBucket *tMemBucketCreate(int32_t totalSlots, int32_t nBufferSize, int16_t nElemSize, int16_t dataType, tMemBucket *tMemBucketCreate(int32_t totalSlots, int32_t nBufferSize, int16_t nElemSize, int16_t dataType,
tOrderDescriptor *pDesc) { tOrderDescriptor *pDesc) {
tMemBucket *pBucket = (tMemBucket *)malloc(sizeof(tMemBucket)); tMemBucket *pBucket = (tMemBucket *)malloc(sizeof(tMemBucket));
pBucket->nTotalSlots = totalSlots; pBucket->nTotalSlots = totalSlots;
pBucket->nSlotsOfSeg = 1 << 6; // 64 Segments, 16 slots each seg. pBucket->nSlotsOfSeg = 1 << 6; // 64 Segments, 16 slots each seg.
pBucket->dataType = dataType; pBucket->dataType = dataType;
@ -258,6 +257,7 @@ tMemBucket *tMemBucketCreate(int32_t totalSlots, int32_t nBufferSize, int16_t nE
pBucket->numOfTotalPages = pBucket->nTotalBufferSize / pBucket->pageSize; pBucket->numOfTotalPages = pBucket->nTotalBufferSize / pBucket->pageSize;
pBucket->numOfAvailPages = pBucket->numOfTotalPages; pBucket->numOfAvailPages = pBucket->numOfTotalPages;
pBucket->pSegs = NULL;
pBucket->pOrderDesc = pDesc; pBucket->pOrderDesc = pDesc;
switch (pBucket->dataType) { switch (pBucket->dataType) {
@ -315,7 +315,7 @@ tMemBucket *tMemBucketCreate(int32_t totalSlots, int32_t nBufferSize, int16_t nE
pBucket->pSegs[i].pBoundingEntries = NULL; pBucket->pSegs[i].pBoundingEntries = NULL;
} }
uTrace("MemBucket:%p,created,buffer size:%d,elem size:%d", pBucket, pBucket->numOfTotalPages * DEFAULT_PAGE_SIZE, uTrace("MemBucket:%p,created,buffer size:%ld,elem size:%d", pBucket, pBucket->numOfTotalPages * DEFAULT_PAGE_SIZE,
pBucket->nElemSize); pBucket->nElemSize);
return pBucket; return pBucket;
@ -751,7 +751,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
char * thisVal = buffer->data + pMemBucket->nElemSize * currentIdx; char * thisVal = buffer->data + pMemBucket->nElemSize * currentIdx;
char * nextVal = thisVal + pMemBucket->nElemSize; char * nextVal = thisVal + pMemBucket->nElemSize;
double td, nd; double td = 1.0, nd = 1.0;
switch (pMemBucket->dataType) { switch (pMemBucket->dataType) {
case TSDB_DATA_TYPE_SMALLINT: { case TSDB_DATA_TYPE_SMALLINT: {
td = *(int16_t *)thisVal; td = *(int16_t *)thisVal;

View File

@ -6,7 +6,12 @@
#include "queryLog.h" #include "queryLog.h"
int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t size, int32_t rowSize, void* handle) { int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t size, int32_t rowSize, void* handle) {
SDiskbasedResultBuf* pResBuf = calloc(1, sizeof(SDiskbasedResultBuf)); *pResultBuf = calloc(1, sizeof(SDiskbasedResultBuf));
SDiskbasedResultBuf* pResBuf = *pResultBuf;
if (pResBuf == NULL) {
return TSDB_CODE_COM_OUT_OF_MEMORY;
}
pResBuf->numOfRowsPerPage = (DEFAULT_INTERN_BUF_PAGE_SIZE - sizeof(tFilePage)) / rowSize; pResBuf->numOfRowsPerPage = (DEFAULT_INTERN_BUF_PAGE_SIZE - sizeof(tFilePage)) / rowSize;
pResBuf->numOfPages = size; pResBuf->numOfPages = size;
@ -46,7 +51,6 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t si
qTrace("QInfo:%p create tmp file for output result, %s, %" PRId64 "bytes", handle, pResBuf->path, qTrace("QInfo:%p create tmp file for output result, %s, %" PRId64 "bytes", handle, pResBuf->path,
pResBuf->totalBufSize); pResBuf->totalBufSize);
*pResultBuf = pResBuf;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -210,7 +214,7 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf, void* handle) {
} }
int32_t getLastPageId(SIDList *pList) { int32_t getLastPageId(SIDList *pList) {
if (pList == NULL && pList->size <= 0) { if (pList == NULL || pList->size <= 0) {
return -1; return -1;
} }

View File

@ -533,7 +533,7 @@ STSVnodeBlockInfo* tsBufGetVnodeBlockInfo(STSBuf* pTSBuf, int32_t vnodeId) {
} }
int32_t STSBufUpdateHeader(STSBuf* pTSBuf, STSBufFileHeader* pHeader) { int32_t STSBufUpdateHeader(STSBuf* pTSBuf, STSBufFileHeader* pHeader) {
if ((pTSBuf->f == NULL) || pHeader == NULL || pHeader->numOfVnode < 0 || pHeader->magic != TS_COMP_FILE_MAGIC) { if ((pTSBuf->f == NULL) || pHeader == NULL || pHeader->numOfVnode == 0 || pHeader->magic != TS_COMP_FILE_MAGIC) {
return -1; return -1;
} }

View File

@ -357,7 +357,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
if (pVariant->nType == TSDB_DATA_TYPE_NCHAR) { if (pVariant->nType == TSDB_DATA_TYPE_NCHAR) {
size_t newSize = pVariant->nLen * TSDB_NCHAR_SIZE; size_t newSize = pVariant->nLen * TSDB_NCHAR_SIZE;
if (pBuf != NULL) { if (pBuf != NULL) {
if (newSize > INITIAL_ALLOC_SIZE) { if (newSize >= INITIAL_ALLOC_SIZE) {
pBuf = realloc(pBuf, newSize + 1); pBuf = realloc(pBuf, newSize + 1);
} }

View File

@ -334,19 +334,19 @@ TEST(testCase, parse_time) {
int64_t time = 0, time1 = 0; int64_t time = 0, time1 = 0;
taosParseTime(t1, &time, strlen(t1), TSDB_TIME_PRECISION_MILLI); taosParseTime(t1, &time, strlen(t1), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 1514739661952); EXPECT_EQ(time, 1514739661952);
taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, timezone * MILLISECOND_PER_SECOND); EXPECT_EQ(time, timezone * MILLISECOND_PER_SECOND);
char t2[] = "2018-1-1T1:1:1.952Z"; char t2[] = "2018-1-1T1:1:1.952Z";
taosParseTime(t2, &time, strlen(t2), TSDB_TIME_PRECISION_MILLI); taosParseTime(t2, &time, strlen(t2), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 1514739661952 + 28800000); EXPECT_EQ(time, 1514739661952 + 28800000);
char t3[] = "2018-1-1 1:01:01.952"; char t3[] = "2018-1-1 1:01:01.952";
taosParseTime(t3, &time, strlen(t3), TSDB_TIME_PRECISION_MILLI); taosParseTime(t3, &time, strlen(t3), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 1514739661952); EXPECT_EQ(time, 1514739661952);
char t4[] = "2018-1-1 1:01:01.9"; char t4[] = "2018-1-1 1:01:01.9";
@ -355,89 +355,89 @@ TEST(testCase, parse_time) {
char t7[] = "2018-01-01 01:01:01.9"; char t7[] = "2018-01-01 01:01:01.9";
char t8[] = "2018-01-01 01:01:01.9007865"; char t8[] = "2018-01-01 01:01:01.9007865";
taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI); taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t5, &time1, strlen(t5), TSDB_TIME_PRECISION_MILLI); taosParseTime(t5, &time1, strlen(t5), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI); taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t6, &time1, strlen(t6), TSDB_TIME_PRECISION_MILLI); taosParseTime(t6, &time1, strlen(t6), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI); taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t7, &time1, strlen(t7), TSDB_TIME_PRECISION_MILLI); taosParseTime(t7, &time1, strlen(t7), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
taosParseTime(t5, &time, strlen(t5), TSDB_TIME_PRECISION_MILLI); taosParseTime(t5, &time, strlen(t5), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t8, &time1, strlen(t8), TSDB_TIME_PRECISION_MILLI); taosParseTime(t8, &time1, strlen(t8), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
char t9[] = "2017-4-3 1:1:2.980"; char t9[] = "2017-4-3 1:1:2.980";
char t10[] = "2017-4-3T2:1:2.98+9:00"; char t10[] = "2017-4-3T2:1:2.98+9:00";
taosParseTime(t9, &time, strlen(t9), TSDB_TIME_PRECISION_MILLI); taosParseTime(t9, &time, strlen(t9), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI); taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
char t11[] = "2017-4-3T2:1:2.98+09:00"; char t11[] = "2017-4-3T2:1:2.98+09:00";
taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI); taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI); taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
char t12[] = "2017-4-3T2:1:2.98+0900"; char t12[] = "2017-4-3T2:1:2.98+0900";
taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI); taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI, 0);
taosParseTime(t12, &time1, strlen(t12), TSDB_TIME_PRECISION_MILLI); taosParseTime(t12, &time1, strlen(t12), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, time1); EXPECT_EQ(time, time1);
taos_options(TSDB_OPTION_TIMEZONE, "UTC"); taos_options(TSDB_OPTION_TIMEZONE, "UTC");
taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 0); EXPECT_EQ(time, 0);
taos_options(TSDB_OPTION_TIMEZONE, "Asia/Shanghai"); taos_options(TSDB_OPTION_TIMEZONE, "Asia/Shanghai");
char t14[] = "1970-1-1T0:0:0Z"; char t14[] = "1970-1-1T0:0:0Z";
taosParseTime(t14, &time, strlen(t14), TSDB_TIME_PRECISION_MILLI); taosParseTime(t14, &time, strlen(t14), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 0); EXPECT_EQ(time, 0);
char t40[] = "1970-1-1 0:0:0.999999999"; char t40[] = "1970-1-1 0:0:0.999999999";
taosParseTime(t40, &time, strlen(t40), TSDB_TIME_PRECISION_MILLI); taosParseTime(t40, &time, strlen(t40), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 999 + timezone * MILLISECOND_PER_SECOND); EXPECT_EQ(time, 999 + timezone * MILLISECOND_PER_SECOND);
char t41[] = "1997-1-1 0:0:0.999999999"; char t41[] = "1997-1-1 0:0:0.999999999";
taosParseTime(t41, &time, strlen(t41), TSDB_TIME_PRECISION_MILLI); taosParseTime(t41, &time, strlen(t41), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 852048000999); EXPECT_EQ(time, 852048000999);
int64_t k = timezone; int64_t k = timezone;
char t42[] = "1997-1-1T0:0:0.999999999Z"; char t42[] = "1997-1-1T0:0:0.999999999Z";
taosParseTime(t42, &time, strlen(t42), TSDB_TIME_PRECISION_MILLI); taosParseTime(t42, &time, strlen(t42), TSDB_TIME_PRECISION_MILLI, 0);
EXPECT_EQ(time, 852048000999 - timezone * MILLISECOND_PER_SECOND); EXPECT_EQ(time, 852048000999 - timezone * MILLISECOND_PER_SECOND);
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// illegal timestamp format // illegal timestamp format
char t15[] = "2017-12-33 0:0:0"; char t15[] = "2017-12-33 0:0:0";
EXPECT_EQ(taosParseTime(t15, &time, strlen(t15), TSDB_TIME_PRECISION_MILLI), -1); EXPECT_EQ(taosParseTime(t15, &time, strlen(t15), TSDB_TIME_PRECISION_MILLI, 0), -1);
char t16[] = "2017-12-31 99:0:0"; char t16[] = "2017-12-31 99:0:0";
EXPECT_EQ(taosParseTime(t16, &time, strlen(t16), TSDB_TIME_PRECISION_MILLI), -1); EXPECT_EQ(taosParseTime(t16, &time, strlen(t16), TSDB_TIME_PRECISION_MILLI, 0), -1);
char t17[] = "2017-12-31T9:0:0"; char t17[] = "2017-12-31T9:0:0";
EXPECT_EQ(taosParseTime(t17, &time, strlen(t17), TSDB_TIME_PRECISION_MILLI), -1); EXPECT_EQ(taosParseTime(t17, &time, strlen(t17), TSDB_TIME_PRECISION_MILLI, 0), -1);
char t18[] = "2017-12-31T9:0:0.Z"; char t18[] = "2017-12-31T9:0:0.Z";
EXPECT_EQ(taosParseTime(t18, &time, strlen(t18), TSDB_TIME_PRECISION_MILLI), -1); EXPECT_EQ(taosParseTime(t18, &time, strlen(t18), TSDB_TIME_PRECISION_MILLI, 0), -1);
char t19[] = "2017-12-31 9:0:0.-1"; char t19[] = "2017-12-31 9:0:0.-1";
EXPECT_EQ(taosParseTime(t19, &time, strlen(t19), TSDB_TIME_PRECISION_MILLI), -1); EXPECT_EQ(taosParseTime(t19, &time, strlen(t19), TSDB_TIME_PRECISION_MILLI, 0), -1);
char t20[] = "2017-12-31 9:0:0.1+12:99"; char t20[] = "2017-12-31 9:0:0.1+12:99";
EXPECT_EQ(taosParseTime(t20, &time, strlen(t20), TSDB_TIME_PRECISION_MILLI), 0); EXPECT_EQ(taosParseTime(t20, &time, strlen(t20), TSDB_TIME_PRECISION_MILLI, 0), 0);
EXPECT_EQ(time, 1514682000100); EXPECT_EQ(time, 1514682000100);
char t21[] = "2017-12-31T9:0:0.1+12:99"; char t21[] = "2017-12-31T9:0:0.1+12:99";
EXPECT_EQ(taosParseTime(t21, &time, strlen(t21), TSDB_TIME_PRECISION_MILLI), -1); EXPECT_EQ(taosParseTime(t21, &time, strlen(t21), TSDB_TIME_PRECISION_MILLI, 0), -1);
char t22[] = "2017-12-31 9:0:0.1+13:1"; char t22[] = "2017-12-31 9:0:0.1+13:1";
EXPECT_EQ(taosParseTime(t22, &time, strlen(t22), TSDB_TIME_PRECISION_MILLI), 0); EXPECT_EQ(taosParseTime(t22, &time, strlen(t22), TSDB_TIME_PRECISION_MILLI, 0), 0);
char t23[] = "2017-12-31T9:0:0.1+13:1"; char t23[] = "2017-12-31T9:0:0.1+13:1";
EXPECT_EQ(taosParseTime(t23, &time, strlen(t23), TSDB_TIME_PRECISION_MILLI), 0); EXPECT_EQ(taosParseTime(t23, &time, strlen(t23), TSDB_TIME_PRECISION_MILLI, 0), 0);
} }
TEST(testCase, tvariant_convert) { TEST(testCase, tvariant_convert) {

View File

@ -695,6 +695,7 @@ static SRpcConn *rpcGetConnObj(SRpcInfo *pRpc, int sid, SRecvInfo *pRecv) {
if (pConn) { if (pConn) {
if (pConn->linkUid != pHead->linkUid) { if (pConn->linkUid != pHead->linkUid) {
terrno = TSDB_CODE_RPC_MISMATCHED_LINK_ID; terrno = TSDB_CODE_RPC_MISMATCHED_LINK_ID;
tError("%s %p %p, linkUid:0x%x is not matched with received:0x%x", pRpc->label, pConn, pHead->ahandle, pConn->linkUid, pHead->linkUid);
pConn = NULL; pConn = NULL;
} }
} }

View File

@ -127,7 +127,7 @@ python3 ./test.py -f user/user_create.py
python3 ./test.py -f user/pass_len.py python3 ./test.py -f user/pass_len.py
# table # table
#python3 ./test.py -f table/del_stable.py python3 ./test.py -f table/del_stable.py
#query #query
python3 ./test.py -f query/filter.py python3 ./test.py -f query/filter.py

View File

@ -22,12 +22,12 @@ class TDTestCase:
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
self.powers = [7, 15, 31, 63] self.powers = [7, 15, 31, 63]
self.types = ["tinyint", "smallint", "int", "bigint"] self.types = ["tinyint", "smallint", "int", "bigint"]
self.rowNum = 10 self.rowNum = 10
self.ts = 1537146000000 self.ts = 1537146000000
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
@ -35,20 +35,30 @@ class TDTestCase:
curType = self.types[i] curType = self.types[i]
print("======= Verify filter for %s type =========" % (curType)) print("======= Verify filter for %s type =========" % (curType))
tdLog.debug( tdLog.debug(
"create table st%s(ts timestamp, num %s) tags(id %s)" % (curType, curType, curType)) "create table st%s(ts timestamp, num %s) tags(id %s)" %
(curType, curType, curType))
tdSql.execute( tdSql.execute(
"create table st%s(ts timestamp, num %s) tags(id %s)" % (curType, curType, curType)) "create table st%s(ts timestamp, num %s) tags(id %s)" %
(curType, curType, curType))
#create 10 tables, insert 10 rows for each table
for j in range(self.rowNum): # create 10 tables, insert 10 rows for each table
tdSql.execute("create table st%s%d using st%s tags(%d)" % (curType, j + 1, curType, j + 1)) for j in range(self.rowNum):
for k in range(self.rowNum): tdSql.execute(
tdSql.execute("insert into st%s%d values(%d, %d)" % (curType, j + 1, self.ts + k + 1, j * 10 + k + 1)) "create table st%s%d using st%s tags(%d)" %
(curType, j + 1, curType, j + 1))
tdSql.error("insert into st%s10 values(%d, %d)" % (curType, self.ts + 11, pow(2, self.powers[i]))) for k in range(self.rowNum):
tdSql.execute("insert into st%s10 values(%d, %d)" % (curType, self.ts + 12, pow(2, self.powers[i]) - 1)) tdSql.execute(
tdSql.error("insert into st%s10 values(%d, %d)" % (curType, self.ts + 13, pow(-2, self.powers[i]))) "insert into st%s%d values(%d, %d)" %
tdSql.execute("insert into st%s10 values(%d, %d)" % (curType, self.ts + 14, pow(-2, self.powers[i]) + 1)) (curType, j + 1, self.ts + k + 1, j * 10 + k + 1))
tdSql.error("insert into st%s10 values(%d, %d)" %
(curType, self.ts + 11, pow(2, self.powers[i])))
tdSql.execute("insert into st%s10 values(%d, %d)" %
(curType, self.ts + 12, pow(2, self.powers[i]) - 1))
tdSql.error("insert into st%s10 values(%d, %d)" %
(curType, self.ts + 13, pow(-2, self.powers[i])))
tdSql.execute("insert into st%s10 values(%d, %d)" %
(curType, self.ts + 14, pow(-2, self.powers[i]) + 1))
# > for int type on column # > for int type on column
tdSql.query("select * from st%s where num > 50" % curType) tdSql.query("select * from st%s where num > 50" % curType)
@ -104,10 +114,12 @@ class TDTestCase:
# != for int type on tag # != for int type on tag
tdSql.query("select * from st%s where id != 5" % curType) tdSql.query("select * from st%s where id != 5" % curType)
tdSql.checkRows(92) tdSql.checkRows(92)
print(
"======= Verify filter for %s type finished =========" %
curType)
print("======= Verify filter for %s type finished =========" % curType)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)

View File

@ -21,28 +21,28 @@ from util.sql import *
class TDTestCase: class TDTestCase:
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
self.rowNum = 10 self.rowNum = 10
self.ts = 1537146000000 self.ts = 1537146000000
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
print("======= Verify filter for float and double type =========") print("======= Verify filter for float and double type =========")
tdLog.debug( tdLog.debug(
"create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)") "create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)")
tdSql.execute( tdSql.execute(
"create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)") "create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)")
for j in range(self.rowNum): for j in range(self.rowNum):
tdSql.execute( tdSql.execute("insert into st1 using st tags(1.1, 2.3) values(%d, %f, %f)" % (
"insert into st1 using st tags(1.1, 2.3) values(%d, %f, %f)" % (self.ts + j + 1, 1.1 * (j + 1), 2.3 * (j + 1))) self.ts + j + 1, 1.1 * (j + 1), 2.3 * (j + 1)))
# > for float type on column # > for float type on column
tdSql.query("select * from st where num > 5.5") tdSql.query("select * from st where num > 5.5")
tdSql.checkRows(5) tdSql.checkRows(5)
# >= for float type on column # >= for float type on column
tdSql.query("select * from st where num >= 5.5") tdSql.query("select * from st where num >= 5.5")
tdSql.checkRows(6) tdSql.checkRows(6)
@ -70,11 +70,11 @@ class TDTestCase:
# > for float type on tag # > for float type on tag
tdSql.query("select * from st where tagcol1 > 1.1") tdSql.query("select * from st where tagcol1 > 1.1")
tdSql.checkRows(0) tdSql.checkRows(0)
# >= for float type on tag # >= for float type on tag
tdSql.query("select * from st where tagcol1 >= 1.1") tdSql.query("select * from st where tagcol1 >= 1.1")
tdSql.checkRows(10) tdSql.checkRows(10)
# = for float type on tag # = for float type on tag
tdSql.query("select * from st where tagcol1 = 1.1") tdSql.query("select * from st where tagcol1 = 1.1")
tdSql.checkRows(10) tdSql.checkRows(10)
@ -86,7 +86,7 @@ class TDTestCase:
# != for float type on tag # != for float type on tag
tdSql.query("select * from st where tagcol1 != 1.1") tdSql.query("select * from st where tagcol1 != 1.1")
tdSql.checkRows(0) tdSql.checkRows(0)
# <= for float type on tag # <= for float type on tag
tdSql.query("select * from st where tagcol1 <= 1.1") tdSql.query("select * from st where tagcol1 <= 1.1")
tdSql.checkRows(10) tdSql.checkRows(10)
@ -94,11 +94,11 @@ class TDTestCase:
# < for float type on tag # < for float type on tag
tdSql.query("select * from st where tagcol1 < 1.1") tdSql.query("select * from st where tagcol1 < 1.1")
tdSql.checkRows(0) tdSql.checkRows(0)
# > for double type on column # > for double type on column
tdSql.query("select * from st where speed > 11.5") tdSql.query("select * from st where speed > 11.5")
tdSql.checkRows(5) tdSql.checkRows(5)
# >= for double type on column # >= for double type on column
tdSql.query("select * from st where speed >= 11.5") tdSql.query("select * from st where speed >= 11.5")
tdSql.checkRows(6) tdSql.checkRows(6)
@ -126,11 +126,11 @@ class TDTestCase:
# > for double type on tag # > for double type on tag
tdSql.query("select * from st where tagcol2 > 2.3") tdSql.query("select * from st where tagcol2 > 2.3")
tdSql.checkRows(0) tdSql.checkRows(0)
# >= for double type on tag # >= for double type on tag
tdSql.query("select * from st where tagcol2 >= 2.3") tdSql.query("select * from st where tagcol2 >= 2.3")
tdSql.checkRows(10) tdSql.checkRows(10)
# = for double type on tag # = for double type on tag
tdSql.query("select * from st where tagcol2 = 2.3") tdSql.query("select * from st where tagcol2 = 2.3")
tdSql.checkRows(10) tdSql.checkRows(10)
@ -142,7 +142,7 @@ class TDTestCase:
# != for double type on tag # != for double type on tag
tdSql.query("select * from st where tagcol2 != 2.3") tdSql.query("select * from st where tagcol2 != 2.3")
tdSql.checkRows(0) tdSql.checkRows(0)
# <= for double type on tag # <= for double type on tag
tdSql.query("select * from st where tagcol2 <= 2.3") tdSql.query("select * from st where tagcol2 <= 2.3")
tdSql.checkRows(10) tdSql.checkRows(10)
@ -150,7 +150,7 @@ class TDTestCase:
# < for double type on tag # < for double type on tag
tdSql.query("select * from st where tagcol2 < 2.3") tdSql.query("select * from st where tagcol2 < 2.3")
tdSql.checkRows(0) tdSql.checkRows(0)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)

View File

@ -21,33 +21,39 @@ from util.sql import *
class TDTestCase: class TDTestCase:
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
self.ts = 1537146000000 self.ts = 1537146000000
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
print("======= Verify filter for bool, nchar and binary type =========") print("======= Verify filter for bool, nchar and binary type =========")
tdLog.debug( tdLog.debug(
"create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))") "create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))")
tdSql.execute( tdSql.execute(
"create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))") "create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))")
tdSql.execute("create table st1 using st tags(true, 'table1', '水表')") tdSql.execute("create table st1 using st tags(true, 'table1', '水表')")
for i in range(1, 6): for i in range(1, 6):
tdSql.execute("insert into st1 values(%d, %d, 'taosdata%d', '涛思数据%d')" % (self.ts + i, i % 2, i, i)) tdSql.execute(
"insert into st1 values(%d, %d, 'taosdata%d', '涛思数据%d')" %
(self.ts + i, i %
2, i, i))
tdSql.execute("create table st2 using st tags(false, 'table2', '电表')") tdSql.execute("create table st2 using st tags(false, 'table2', '电表')")
for i in range(6, 11): for i in range(6, 11):
tdSql.execute("insert into st2 values(%d, %d, 'taosdata%d', '涛思数据%d')" % (self.ts + i, i % 2, i, i)) tdSql.execute(
"insert into st2 values(%d, %d, 'taosdata%d', '涛思数据%d')" %
(self.ts + i, i %
2, i, i))
# =============Verify stable columns==================== # =============Verify stable columns====================
# > for bool type on column # > for bool type on column
tdSql.error("select * from st where tbcol1 > false") tdSql.error("select * from st where tbcol1 > false")
# >= for bool type on column # >= for bool type on column
tdSql.error("select * from st where tbcol1 >= false") tdSql.error("select * from st where tbcol1 >= false")
# = for bool type on column # = for bool type on column
tdSql.query("select * from st where tbcol1 = false") tdSql.query("select * from st where tbcol1 = false")
@ -77,18 +83,18 @@ class TDTestCase:
tdSql.error("select * from st where tbcol2 > 'taosdata'") tdSql.error("select * from st where tbcol2 > 'taosdata'")
# >= for nchar type on column # >= for nchar type on column
tdSql.error("select * from st where tbcol2 >= 'taosdata'") tdSql.error("select * from st where tbcol2 >= 'taosdata'")
# = for nchar type on column # = for nchar type on column
tdSql.query("select * from st where tbcol2 = 'taosdata1'") tdSql.query("select * from st where tbcol2 = 'taosdata1'")
tdSql.checkRows(1) tdSql.checkRows(1)
# <> for nchar type on column # <> for nchar type on column
tdSql.query("select * from st where tbcol2 <> 'taosdata1'") tdSql.query("select * from st where tbcol2 <> 'taosdata1'")
tdSql.checkRows(9) tdSql.checkRows(9)
# != for nchar type on column # != for nchar type on column
tdSql.query("select * from st where tbcol2 != 'taosdata1'") tdSql.query("select * from st where tbcol2 != 'taosdata1'")
tdSql.checkRows(9) tdSql.checkRows(9)
# > for nchar type on column # > for nchar type on column
@ -98,57 +104,57 @@ class TDTestCase:
tdSql.error("select * from st where tbcol2 <= 'taodata'") tdSql.error("select * from st where tbcol2 <= 'taodata'")
# % for nchar type on column case 1 # % for nchar type on column case 1
tdSql.query("select * from st where tbcol2 like '%'") tdSql.query("select * from st where tbcol2 like '%'")
tdSql.checkRows(10) tdSql.checkRows(10)
# % for nchar type on column case 2 # % for nchar type on column case 2
tdSql.query("select * from st where tbcol2 like 'a%'") tdSql.query("select * from st where tbcol2 like 'a%'")
tdSql.checkRows(0) tdSql.checkRows(0)
# % for nchar type on column case 3 # % for nchar type on column case 3
tdSql.query("select * from st where tbcol2 like 't%_'") tdSql.query("select * from st where tbcol2 like 't%_'")
tdSql.checkRows(10) tdSql.checkRows(10)
# % for nchar type on column case 4 # % for nchar type on column case 4
tdSql.query("select * from st where tbcol2 like '%1'") tdSql.query("select * from st where tbcol2 like '%1'")
# tdSql.checkRows(2) # tdSql.checkRows(2)
# _ for nchar type on column case 1 # _ for nchar type on column case 1
tdSql.query("select * from st where tbcol2 like '____________'") tdSql.query("select * from st where tbcol2 like '____________'")
tdSql.checkRows(0) tdSql.checkRows(0)
# _ for nchar type on column case 2 # _ for nchar type on column case 2
tdSql.query("select * from st where tbcol2 like '__________'") tdSql.query("select * from st where tbcol2 like '__________'")
tdSql.checkRows(1) tdSql.checkRows(1)
# _ for nchar type on column case 3 # _ for nchar type on column case 3
tdSql.query("select * from st where tbcol2 like '_________'") tdSql.query("select * from st where tbcol2 like '_________'")
tdSql.checkRows(9) tdSql.checkRows(9)
# _ for nchar type on column case 4 # _ for nchar type on column case 4
tdSql.query("select * from st where tbcol2 like 't________'") tdSql.query("select * from st where tbcol2 like 't________'")
tdSql.checkRows(9) tdSql.checkRows(9)
# _ for nchar type on column case 5 # _ for nchar type on column case 5
tdSql.query("select * from st where tbcol2 like '%________'") tdSql.query("select * from st where tbcol2 like '%________'")
tdSql.checkRows(10) tdSql.checkRows(10)
# > for binary type on column # > for binary type on column
tdSql.error("select * from st where tbcol3 > '涛思数据'") tdSql.error("select * from st where tbcol3 > '涛思数据'")
# >= for binary type on column # >= for binary type on column
tdSql.error("select * from st where tbcol3 >= '涛思数据'") tdSql.error("select * from st where tbcol3 >= '涛思数据'")
# = for binary type on column # = for binary type on column
tdSql.query("select * from st where tbcol3 = '涛思数据1'") tdSql.query("select * from st where tbcol3 = '涛思数据1'")
tdSql.checkRows(1) tdSql.checkRows(1)
# <> for binary type on column # <> for binary type on column
tdSql.query("select * from st where tbcol3 <> '涛思数据1'") tdSql.query("select * from st where tbcol3 <> '涛思数据1'")
tdSql.checkRows(9) tdSql.checkRows(9)
# != for binary type on column # != for binary type on column
tdSql.query("select * from st where tbcol3 != '涛思数据1'") tdSql.query("select * from st where tbcol3 != '涛思数据1'")
tdSql.checkRows(9) tdSql.checkRows(9)
# > for binary type on column # > for binary type on column
@ -158,39 +164,39 @@ class TDTestCase:
tdSql.error("select * from st where tbcol3 <= '涛思数据'") tdSql.error("select * from st where tbcol3 <= '涛思数据'")
# % for binary type on column case 1 # % for binary type on column case 1
tdSql.query("select * from st where tbcol3 like '%'") tdSql.query("select * from st where tbcol3 like '%'")
tdSql.checkRows(10) tdSql.checkRows(10)
# % for binary type on column case 2 # % for binary type on column case 2
tdSql.query("select * from st where tbcol3 like '%'") tdSql.query("select * from st where tbcol3 like '%'")
tdSql.checkRows(0) tdSql.checkRows(0)
# % for binary type on column case 3 # % for binary type on column case 3
tdSql.query("select * from st where tbcol3 like '%_'") tdSql.query("select * from st where tbcol3 like '%_'")
tdSql.checkRows(10) tdSql.checkRows(10)
# % for binary type on column case 4 # % for binary type on column case 4
tdSql.query("select * from st where tbcol3 like '%1'") tdSql.query("select * from st where tbcol3 like '%1'")
tdSql.checkRows(1) tdSql.checkRows(1)
# _ for binary type on column case 1 # _ for binary type on column case 1
tdSql.query("select * from st where tbcol3 like '_______'") tdSql.query("select * from st where tbcol3 like '_______'")
tdSql.checkRows(0) tdSql.checkRows(0)
# _ for binary type on column case 2 # _ for binary type on column case 2
tdSql.query("select * from st where tbcol3 like '______'") tdSql.query("select * from st where tbcol3 like '______'")
tdSql.checkRows(1) tdSql.checkRows(1)
# _ for binary type on column case 2 # _ for binary type on column case 2
tdSql.query("select * from st where tbcol3 like '_____'") tdSql.query("select * from st where tbcol3 like '_____'")
tdSql.checkRows(9) tdSql.checkRows(9)
# _ for binary type on column case 3 # _ for binary type on column case 3
tdSql.query("select * from st where tbcol3 like '____'") tdSql.query("select * from st where tbcol3 like '____'")
tdSql.checkRows(0) tdSql.checkRows(0)
# _ for binary type on column case 4 # _ for binary type on column case 4
tdSql.query("select * from st where tbcol3 like 't____'") tdSql.query("select * from st where tbcol3 like 't____'")
tdSql.checkRows(0) tdSql.checkRows(0)
# =============Verify stable tags==================== # =============Verify stable tags====================
@ -198,7 +204,7 @@ class TDTestCase:
tdSql.error("select * from st where tagcol1 > false") tdSql.error("select * from st where tagcol1 > false")
# >= for bool type on tag # >= for bool type on tag
tdSql.error("select * from st where tagcol1 >= false") tdSql.error("select * from st where tagcol1 >= false")
# = for bool type on tag # = for bool type on tag
tdSql.query("select * from st where tagcol1 = false") tdSql.query("select * from st where tagcol1 = false")
@ -228,18 +234,18 @@ class TDTestCase:
tdSql.error("select * from st where tagcol2 > 'table'") tdSql.error("select * from st where tagcol2 > 'table'")
# >= for nchar type on tag # >= for nchar type on tag
tdSql.error("select * from st where tagcol2 >= 'table'") tdSql.error("select * from st where tagcol2 >= 'table'")
# = for nchar type on tag # = for nchar type on tag
tdSql.query("select * from st where tagcol2 = 'table1'") tdSql.query("select * from st where tagcol2 = 'table1'")
tdSql.checkRows(5) tdSql.checkRows(5)
# <> for nchar type on tag # <> for nchar type on tag
tdSql.query("select * from st where tagcol2 <> 'table1'") tdSql.query("select * from st where tagcol2 <> 'table1'")
tdSql.checkRows(5) tdSql.checkRows(5)
# != for nchar type on tag # != for nchar type on tag
tdSql.query("select * from st where tagcol2 != 'table'") tdSql.query("select * from st where tagcol2 != 'table'")
tdSql.checkRows(10) tdSql.checkRows(10)
# > for nchar type on tag # > for nchar type on tag
@ -249,57 +255,57 @@ class TDTestCase:
tdSql.error("select * from st where tagcol2 <= 'table'") tdSql.error("select * from st where tagcol2 <= 'table'")
# % for nchar type on tag case 1 # % for nchar type on tag case 1
tdSql.query("select * from st where tagcol2 like '%'") tdSql.query("select * from st where tagcol2 like '%'")
tdSql.checkRows(10) tdSql.checkRows(10)
# % for nchar type on tag case 2 # % for nchar type on tag case 2
tdSql.query("select * from st where tagcol2 like 'a%'") tdSql.query("select * from st where tagcol2 like 'a%'")
tdSql.checkRows(0) tdSql.checkRows(0)
# % for nchar type on tag case 3 # % for nchar type on tag case 3
tdSql.query("select * from st where tagcol2 like 't%_'") tdSql.query("select * from st where tagcol2 like 't%_'")
tdSql.checkRows(10) tdSql.checkRows(10)
# % for nchar type on tag case 4 # % for nchar type on tag case 4
tdSql.query("select * from st where tagcol2 like '%1'") tdSql.query("select * from st where tagcol2 like '%1'")
tdSql.checkRows(5) tdSql.checkRows(5)
# _ for nchar type on tag case 1 # _ for nchar type on tag case 1
tdSql.query("select * from st where tagcol2 like '_______'") tdSql.query("select * from st where tagcol2 like '_______'")
tdSql.checkRows(0) tdSql.checkRows(0)
# _ for nchar type on tag case 2 # _ for nchar type on tag case 2
tdSql.query("select * from st where tagcol2 like '______'") tdSql.query("select * from st where tagcol2 like '______'")
tdSql.checkRows(10) tdSql.checkRows(10)
# _ for nchar type on tag case 3 # _ for nchar type on tag case 3
tdSql.query("select * from st where tagcol2 like 't_____'") tdSql.query("select * from st where tagcol2 like 't_____'")
tdSql.checkRows(10) tdSql.checkRows(10)
# _ for nchar type on tag case 4 # _ for nchar type on tag case 4
tdSql.query("select * from st where tagcol2 like 's________'") tdSql.query("select * from st where tagcol2 like 's________'")
tdSql.checkRows(0) tdSql.checkRows(0)
# _ for nchar type on tag case 5 # _ for nchar type on tag case 5
tdSql.query("select * from st where tagcol2 like '%__'") tdSql.query("select * from st where tagcol2 like '%__'")
tdSql.checkRows(10) tdSql.checkRows(10)
# > for binary type on tag # > for binary type on tag
tdSql.error("select * from st where tagcol3 > ''") tdSql.error("select * from st where tagcol3 > ''")
# >= for binary type on tag # >= for binary type on tag
tdSql.error("select * from st where tagcol3 >= ''") tdSql.error("select * from st where tagcol3 >= ''")
# = for binary type on tag # = for binary type on tag
tdSql.query("select * from st where tagcol3 = '水表'") tdSql.query("select * from st where tagcol3 = '水表'")
tdSql.checkRows(5) tdSql.checkRows(5)
# <> for binary type on tag # <> for binary type on tag
tdSql.query("select * from st where tagcol3 <> '水表'") tdSql.query("select * from st where tagcol3 <> '水表'")
tdSql.checkRows(5) tdSql.checkRows(5)
# != for binary type on tag # != for binary type on tag
tdSql.query("select * from st where tagcol3 != '水表'") tdSql.query("select * from st where tagcol3 != '水表'")
tdSql.checkRows(5) tdSql.checkRows(5)
# > for binary type on tag # > for binary type on tag
@ -309,54 +315,53 @@ class TDTestCase:
tdSql.error("select * from st where tagcol3 <= '水表'") tdSql.error("select * from st where tagcol3 <= '水表'")
# % for binary type on tag case 1 # % for binary type on tag case 1
tdSql.query("select * from st where tagcol3 like '%'") tdSql.query("select * from st where tagcol3 like '%'")
tdSql.checkRows(10) tdSql.checkRows(10)
# % for binary type on tag case 2 # % for binary type on tag case 2
tdSql.query("select * from st where tagcol3 like '%'") tdSql.query("select * from st where tagcol3 like '%'")
tdSql.checkRows(5) tdSql.checkRows(5)
# % for binary type on tag case 3 # % for binary type on tag case 3
tdSql.query("select * from st where tagcol3 like '%_'") tdSql.query("select * from st where tagcol3 like '%_'")
tdSql.checkRows(0) tdSql.checkRows(0)
# % for binary type on tag case 4 # % for binary type on tag case 4
tdSql.query("select * from st where tagcol3 like '%'") tdSql.query("select * from st where tagcol3 like '%'")
tdSql.checkRows(10) tdSql.checkRows(10)
# % for binary type on tag case 5 # % for binary type on tag case 5
tdSql.query("select * from st where tagcol3 like '%'") tdSql.query("select * from st where tagcol3 like '%'")
tdSql.checkRows(0) tdSql.checkRows(0)
# _ for binary type on tag case 1 # _ for binary type on tag case 1
tdSql.query("select * from st where tagcol3 like '__'") tdSql.query("select * from st where tagcol3 like '__'")
tdSql.checkRows(10) tdSql.checkRows(10)
# _ for binary type on tag case 2 # _ for binary type on tag case 2
tdSql.query("select * from st where tagcol3 like '水_'") tdSql.query("select * from st where tagcol3 like '水_'")
tdSql.checkRows(5) tdSql.checkRows(5)
# _ for binary type on tag case 2 # _ for binary type on tag case 2
tdSql.query("select * from st where tagcol3 like '_表'") tdSql.query("select * from st where tagcol3 like '_表'")
tdSql.checkRows(10) tdSql.checkRows(10)
# _ for binary type on tag case 3 # _ for binary type on tag case 3
tdSql.query("select * from st where tagcol3 like '___'") tdSql.query("select * from st where tagcol3 like '___'")
tdSql.checkRows(0) tdSql.checkRows(0)
# _ for binary type on tag case 4 # _ for binary type on tag case 4
tdSql.query("select * from st where tagcol3 like '数_'") tdSql.query("select * from st where tagcol3 like '数_'")
tdSql.checkRows(0) tdSql.checkRows(0)
# _ for binary type on tag case 5 # _ for binary type on tag case 5
tdSql.query("select * from st where tagcol3 like '_据'") tdSql.query("select * from st where tagcol3 like '_据'")
tdSql.checkRows(0) tdSql.checkRows(0)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())

View File

@ -21,56 +21,60 @@ from util.sql import *
class TDTestCase: class TDTestCase:
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
self.rowNum = 10 self.rowNum = 10
self.ts = 1537146000000 self.ts = 1537146000000
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
print("======= step 1: create table and insert data =========") print("======= step 1: create table and insert data =========")
tdLog.debug( tdLog.debug(
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double, ''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float, tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))''') tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))''')
tdSql.execute( tdSql.execute(
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double, ''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float, tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))''') tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))''')
for i in range(self.rowNum):
tdSql.execute("create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d')" % (i + 1, i + 1, i + 1, i + 1, i + 1, 1.1 * (i + 1),
1.23 * (i + 1), (i + 1) % 2, i + 1, i + 1))
for j in range(self.rowNum):
tdSql.execute("insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')" % (i + 1, self.ts + 10 * (i + 1) + j + 1,
j + 1, j + 1, j + 1, j + 1, 1.1 * (j + 1), 1.23 * (j + 1), (j + 1) % 2, j + 1, j + 1))
print("======= step 2: verify order for each column =========") for i in range(self.rowNum):
# sort for timestamp in asc order tdSql.execute("create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d')" % (
i + 1, i + 1, i + 1, i + 1, i + 1, 1.1 * (i + 1), 1.23 * (i + 1), (i + 1) % 2, i + 1, i + 1))
for j in range(self.rowNum):
tdSql.execute("insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')" % (
i + 1, self.ts + 10 * (i + 1) + j + 1, j + 1, j + 1, j + 1, j + 1, 1.1 * (j + 1), 1.23 * (j + 1), (j + 1) % 2, j + 1, j + 1))
print("======= step 2: verify order for each column =========")
# sort for timestamp in asc order
tdSql.query("select * from st order by ts asc") tdSql.query("select * from st order by ts asc")
tdSql.checkColumnSorted(0, "asc") tdSql.checkColumnSorted(0, "asc")
# sort for timestamp in desc order # sort for timestamp in desc order
tdSql.query("select * from st order by ts desc") tdSql.query("select * from st order by ts desc")
tdSql.checkColumnSorted(0, "desc") tdSql.checkColumnSorted(0, "desc")
for i in range(1, 10):
tdSql.error("select * from st order by tbcol%d" % i)
tdSql.error("select * from st order by tbcol%d asc" % i)
tdSql.error("select * from st order by tbcol%d desc" % i)
for i in range(1, 10): tdSql.query(
tdSql.error("select * from st order by tbcol%d" % i) "select avg(tbcol1) from st group by tagcol%d order by tagcol%d" %
tdSql.error("select * from st order by tbcol%d asc" % i) (i, i))
tdSql.error("select * from st order by tbcol%d desc" % i)
tdSql.query("select avg(tbcol1) from st group by tagcol%d order by tagcol%d" % (i, i))
tdSql.checkColumnSorted(1, "") tdSql.checkColumnSorted(1, "")
tdSql.query("select avg(tbcol1) from st group by tagcol%d order by tagcol%d asc" % (i, i)) tdSql.query(
"select avg(tbcol1) from st group by tagcol%d order by tagcol%d asc" %
(i, i))
tdSql.checkColumnSorted(1, "asc") tdSql.checkColumnSorted(1, "asc")
tdSql.query("select avg(tbcol1) from st group by tagcol%d order by tagcol%d desc" % (i, i)) tdSql.query(
tdSql.checkColumnSorted(1, "desc") "select avg(tbcol1) from st group by tagcol%d order by tagcol%d desc" %
(i, i))
tdSql.checkColumnSorted(1, "desc")
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)

View File

@ -97,8 +97,11 @@ class Test:
sqlcmd = "create table %s using %s tags (1, 'test')" %(current_tb, self.last_stb) sqlcmd = "create table %s using %s tags (1, 'test')" %(current_tb, self.last_stb)
tdSql.execute(sqlcmd) tdSql.execute(sqlcmd)
self.last_tb = current_tb self.last_tb = current_tb
sqlcmd = "insert into %s values (now, 27, 'testnchar')" % self.last_tb self.written = 0
tdSql.execute(sqlcmd)
tdSql.execute(
"insert into %s values (now, 27, 'wsnchar')" %
self.last_tb)
self.written = self.written + 1 self.written = self.written + 1
def drop_stable(self): def drop_stable(self):

View File

@ -38,9 +38,9 @@ python3 ./test.py -f tag_lite/bool_int.py
python3 ./test.py -f tag_lite/bool.py python3 ./test.py -f tag_lite/bool.py
python3 ./test.py -f tag_lite/change.py python3 ./test.py -f tag_lite/change.py
python3 ./test.py -f tag_lite/column.py python3 ./test.py -f tag_lite/column.py
# python3 ./test.py -f tag_lite/commit.py python3 ./test.py -f tag_lite/commit.py
python3 ./test.py -f tag_lite/create.py python3 ./test.py -f tag_lite/create.py
# python3 ./test.py -f tag_lite/datatype.py python3 ./test.py -f tag_lite/datatype.py
python3 ./test.py -f tag_lite/datatype-without-alter.py python3 ./test.py -f tag_lite/datatype-without-alter.py
# python3 ./test.py -f tag_lite/delete.py # python3 ./test.py -f tag_lite/delete.py
python3 ./test.py -f tag_lite/double.py python3 ./test.py -f tag_lite/double.py
@ -48,7 +48,7 @@ python3 ./test.py -f tag_lite/float.py
python3 ./test.py -f tag_lite/int_binary.py python3 ./test.py -f tag_lite/int_binary.py
python3 ./test.py -f tag_lite/int_float.py python3 ./test.py -f tag_lite/int_float.py
python3 ./test.py -f tag_lite/int.py python3 ./test.py -f tag_lite/int.py
# python3 ./test.py -f tag_lite/set.py python3 ./test.py -f tag_lite/set.py
python3 ./test.py -f tag_lite/smallint.py python3 ./test.py -f tag_lite/smallint.py
python3 ./test.py -f tag_lite/tinyint.py python3 ./test.py -f tag_lite/tinyint.py
@ -127,7 +127,7 @@ python3 ./test.py -f user/user_create.py
python3 ./test.py -f user/pass_len.py python3 ./test.py -f user/pass_len.py
# table # table
# python3 ./test.py -f table/del_stable.py python3 ./test.py -f table/del_stable.py
#query #query
python3 ./test.py -f query/filter.py python3 ./test.py -f query/filter.py

View File

@ -40,13 +40,13 @@ class TDTestCase:
try: try:
tdSql.execute("select * from db.st") tdSql.execute("select * from db.st")
except Exception as e: except Exception as e:
if e.args[0] != 'invalid table name': if e.args[0] != 'mnode invalid table name':
tdLog.exit(e) tdLog.exit(e)
try: try:
tdSql.execute("select * from db.tb") tdSql.execute("select * from db.tb")
except Exception as e: except Exception as e:
if e.args[0] != 'invalid table name': if e.args[0] != 'mnode invalid table name':
tdLog.exit(e) tdLog.exit(e)
def stop(self): def stop(self):

View File

@ -18,7 +18,10 @@ class TDTestCase:
tdSql.prepare() tdSql.prepare()
getTableNameLen = "grep -w '#define TSDB_TABLE_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'" getTableNameLen = "grep -w '#define TSDB_TABLE_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'"
tableNameMaxLen = int( subprocess.check_output(getTableNameLen, shell=True)) - 1 tableNameMaxLen = int(
subprocess.check_output(
getTableNameLen,
shell=True)) - 1
tdLog.info("table name max length is %d" % tableNameMaxLen) tdLog.info("table name max length is %d" % tableNameMaxLen)
chars = string.ascii_uppercase + string.ascii_lowercase chars = string.ascii_uppercase + string.ascii_lowercase
tb_name = ''.join(random.choices(chars, k=tableNameMaxLen)) tb_name = ''.join(random.choices(chars, k=tableNameMaxLen))

View File

@ -93,9 +93,13 @@ class TDTestCase:
tdSql.error("alter table ta_ch_mt2 change tag tgcol1 tgcol2") tdSql.error("alter table ta_ch_mt2 change tag tgcol1 tgcol2")
# TSIM: return -1 # TSIM: return -1
# TSIM: step22: # TSIM: step22:
# TSIM: sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 # TSIM: sql alter table $mt change tag tgcol1
tdLog.info("alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x
tdSql.error("alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") # step20
tdLog.info(
"alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20")
tdSql.error(
"alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20")
# TSIM: return -1 # TSIM: return -1
# TSIM: step20: # TSIM: step20:
# TSIM: # TSIM:
@ -267,8 +271,10 @@ class TDTestCase:
tdSql.execute( tdSql.execute(
'create table ta_ch_mt6 (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))') 'create table ta_ch_mt6 (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))')
# TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) # TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' )
tdLog.info("create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )") tdLog.info(
tdSql.execute("create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )") "create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )")
tdSql.execute(
"create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )")
# TSIM: sql insert into $tb values(now, 1) # TSIM: sql insert into $tb values(now, 1)
tdLog.info("insert into tb6 values(now, 1)") tdLog.info("insert into tb6 values(now, 1)")
tdSql.execute("insert into tb6 values(now, 1)") tdSql.execute("insert into tb6 values(now, 1)")

View File

@ -296,13 +296,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data23 != 1 then # TSIM: if $data23 != 1 then
tdLog.info('tdSql.checkData(2, 3, 1)') tdLog.info('tdSql.checkData(2, 3, "TAG")')
tdSql.checkData(2, 3, 1) tdSql.checkData(2, 3, "TAG")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data33 != 2.000000 then # TSIM: if $data33 != 2.000000 then
tdLog.info('tdSql.checkData(3, 3, 2.000000)') tdLog.info('tdSql.checkData(3, 3, "TAG")')
tdSql.checkData(3, 3, 2.000000) tdSql.checkData(3, 3, "TAG")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -395,8 +395,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 2 then # TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)') tdLog.info('tdSql.checkData(0, 3, "2")')
tdSql.checkData(0, 3, 2) tdSql.checkData(0, 3, "2")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -552,13 +552,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 5 then # TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)') tdLog.info('tdSql.checkData(0, 3, "5")')
tdSql.checkData(0, 3, 5) tdSql.checkData(0, 3, "5")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 6 then # TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)') tdLog.info('tdSql.checkData(0, 4, "6")')
tdSql.checkData(0, 4, 6) tdSql.checkData(0, 4, "6")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -583,13 +583,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 5 then # TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)') tdLog.info('tdSql.checkData(0, 3, "5")')
tdSql.checkData(0, 3, 5) tdSql.checkData(0, 3, "5")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 6 then # TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)') tdLog.info('tdSql.checkData(0, 4, "6")')
tdSql.checkData(0, 4, 6) tdSql.checkData(0, 4, "6")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -653,8 +653,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 3 then # TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)') tdLog.info('tdSql.checkData(0, 4, "3")')
tdSql.checkData(0, 4, 3) tdSql.checkData(0, 4, "3")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -778,8 +778,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 3 then # TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)') tdLog.info('tdSql.checkData(0, 4, "3")')
tdSql.checkData(0, 4, 3) tdSql.checkData(0, 4, "3")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -835,8 +835,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 5 then # TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)') tdLog.info('tdSql.checkData(0, 3, "5")')
tdSql.checkData(0, 3, 5) tdSql.checkData(0, 3, "5")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 1 then # TSIM: if $data04 != 1 then
@ -897,13 +897,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 2 then # TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)') tdLog.info('tdSql.checkData(0, 3, "2")')
tdSql.checkData(0, 3, 2) tdSql.checkData(0, 3, "2")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 3 then # TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)') tdLog.info('tdSql.checkData(0, 4, "3")')
tdSql.checkData(0, 4, 3) tdSql.checkData(0, 4, "3")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -1021,29 +1021,29 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 1 then # TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)') tdLog.info('tdSql.checkData(0, 2, "1")')
tdSql.checkData(0, 2, 1) tdSql.checkData(0, 2, "1")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 2 then # TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)') tdLog.info('tdSql.checkData(0, 3, "2")')
tdSql.checkData(0, 3, 2) tdSql.checkData(0, 3, "2")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 3 then # TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)') tdLog.info('tdSql.checkData(0, 4, "3")')
tdSql.checkData(0, 4, 3) tdSql.checkData(0, 4, "3")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 4 then # TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)') tdLog.info('tdSql.checkData(0, 5, "4")')
tdSql.checkData(0, 5, 4) tdSql.checkData(0, 5, "4")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step103 # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step103
tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step103' % (mt)) tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step103' % (mt))
tdSql.error('alter table %s change tag tgcol1 tgcol403' % (mt)) tdSql.error('alter table %s change tag tgcol1 tgcol4' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step103: # TSIM: step103:
# TSIM: # TSIM:
@ -1095,13 +1095,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 1 then # TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)') tdLog.info('tdSql.checkData(0, 2, "1")')
tdSql.checkData(0, 2, 1) tdSql.checkData(0, 2, "1")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 4 then # TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)') tdLog.info('tdSql.checkData(0, 3, "4")')
tdSql.checkData(0, 3, 4) tdSql.checkData(0, 3, "4")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 0 then # TSIM: if $data04 != 0 then
@ -1111,18 +1111,22 @@ class TDTestCase:
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != NULL then # TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)') tdLog.info('tdSql.checkData(0, 5, NULL)')
tdSql.checkData(0, 5, None) try:
tdSql.checkData(0, 5, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step101 # TSIM: sql select * from $mt where tgcol2 = 1 -x step101
tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt)) tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt))
tdSql.error('select * from %s where tgcol2 = 101' % (mt)) tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step101: # TSIM: step101:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step102 # TSIM: sql select * from $mt where tgcol3 = 1 -x step102
tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt)) tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt))
tdSql.error('select * from %s where tgcol3 = 102' % (mt)) tdSql.error('select * from %s where tgcol3 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step102: # TSIM: step102:
# TSIM: # TSIM:
@ -1186,14 +1190,14 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 5 then # TSIM: if $data06 != 5 then
tdLog.info('tdSql.checkData(0, 6, 5)') tdLog.info('tdSql.checkData(0, 6, "5")')
tdSql.checkData(0, 6, 5) tdSql.checkData(0, 6, "5")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step114 # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step114
tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step114' % (mt)) tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step114' % (mt))
tdSql.error('alter table %s change tag tgcol1 tgcol414' % (mt)) tdSql.error('alter table %s change tag tgcol1 tgcol4' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step114: # TSIM: step114:
# TSIM: # TSIM:
@ -1271,8 +1275,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 4 then # TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)') tdLog.info('tdSql.checkData(0, 3, "4")')
tdSql.checkData(0, 3, 4) tdSql.checkData(0, 3, "4")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 5 then # TSIM: if $data04 != 5 then
@ -1281,8 +1285,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 6 then # TSIM: if $data05 != 6 then
tdLog.info('tdSql.checkData(0, 5, 6)') tdLog.info('tdSql.checkData(0, 5, "6")')
tdSql.checkData(0, 5, 6) tdSql.checkData(0, 5, "6")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 7 then # TSIM: if $data06 != 7 then
@ -1298,17 +1302,17 @@ class TDTestCase:
# TSIM: # TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step111 # TSIM: sql select * from $mt where tgcol2 = 1 -x step111
tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt)) tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt))
tdSql.error('select * from %s where tgcol2 = 111' % (mt)) tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step111: # TSIM: step111:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step112 # TSIM: sql select * from $mt where tgcol3 = 1 -x step112
tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt)) tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt))
tdSql.error('select * from %s where tgcol3 = 112' % (mt)) tdSql.error('select * from %s where tgcol3 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step112: # TSIM: step112:
# TSIM: sql select * from $mt where tgcol9 = 1 -x step113 # TSIM: sql select * from $mt where tgcol9 = 1 -x step113
tdLog.info('select * from %s where tgcol9 = 1 -x step113' % (mt)) tdLog.info('select * from %s where tgcol9 = 1 -x step113' % (mt))
tdSql.error('select * from %s where tgcol9 = 113' % (mt)) tdSql.error('select * from %s where tgcol9 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step113: # TSIM: step113:
# TSIM: # TSIM:
@ -1373,13 +1377,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 5 then # TSIM: if $data06 != 5 then
tdLog.info('tdSql.checkData(0, 6, 5)') tdLog.info('tdSql.checkData(0, 6, "5")')
tdSql.checkData(0, 6, 5) tdSql.checkData(0, 6, "5")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != 6 then # TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, 6)') tdLog.info('tdSql.checkData(0, 7, "6")')
tdSql.checkData(0, 7, 6) tdSql.checkData(0, 7, "6")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -1457,13 +1461,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 1 then # TSIM: if $data03 != 1 then
tdLog.info('tdSql.checkData(0, 3, 1)') tdLog.info('tdSql.checkData(0, 3, "1")')
tdSql.checkData(0, 3, 1) tdSql.checkData(0, 3, "1")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 5 then # TSIM: if $data04 != 5 then
tdLog.info('tdSql.checkData(0, 4, 5)') tdLog.info('tdSql.checkData(0, 4, "5")')
tdSql.checkData(0, 4, 5) tdSql.checkData(0, 4, "5")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 4 then # TSIM: if $data05 != 4 then
@ -1472,8 +1476,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 3 then # TSIM: if $data06 != 3 then
tdLog.info('tdSql.checkData(0, 6, 3)') tdLog.info('tdSql.checkData(0, 6, "3")')
tdSql.checkData(0, 6, 3) tdSql.checkData(0, 6, "3")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != 2 then # TSIM: if $data07 != 2 then
@ -1559,8 +1563,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 1 then # TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)') tdLog.info('tdSql.checkData(0, 2, "1")')
tdSql.checkData(0, 2, 1) tdSql.checkData(0, 2, "1")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 2 then # TSIM: if $data03 != 2 then
@ -1574,8 +1578,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 4 then # TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)') tdLog.info('tdSql.checkData(0, 5, "4")')
tdSql.checkData(0, 5, 4) tdSql.checkData(0, 5, "4")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 5.000000000 then # TSIM: if $data06 != 5.000000000 then
@ -1584,8 +1588,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != 6 then # TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, 6)') tdLog.info('tdSql.checkData(0, 7, "6")')
tdSql.checkData(0, 7, 6) tdSql.checkData(0, 7, "6")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -1652,8 +1656,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 7 then # TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)') tdLog.info('tdSql.checkData(0, 2, "7")')
tdSql.checkData(0, 2, 7) tdSql.checkData(0, 2, "7")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 9 then # TSIM: if $data03 != 9 then
@ -1667,8 +1671,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 8 then # TSIM: if $data05 != 8 then
tdLog.info('tdSql.checkData(0, 5, 8)') tdLog.info('tdSql.checkData(0, 5, "8")')
tdSql.checkData(0, 5, 8) tdSql.checkData(0, 5, "8")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 10 then # TSIM: if $data06 != 10 then
@ -1867,13 +1871,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 5 then # TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)') tdLog.info('tdSql.checkData(0, 3, "5")')
tdSql.checkData(0, 3, 5) tdSql.checkData(0, 3, "5")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 6 then # TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)') tdLog.info('tdSql.checkData(0, 4, "6")')
tdSql.checkData(0, 4, 6) tdSql.checkData(0, 4, "6")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -1898,13 +1902,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 5 then # TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)') tdLog.info(': tdSql.checkData(0, 3, "5")')
tdSql.checkData(0, 3, 5) tdSql.checkData(0, 3, "5")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 6 then # TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)') tdLog.info('tdSql.checkData(0, 4, "6")')
tdSql.checkData(0, 4, 6) tdSql.checkData(0, 4, "6")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -1988,8 +1992,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 5 then # TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)') tdLog.info('tdSql.checkData(0, 3, "5")')
tdSql.checkData(0, 3, 5) tdSql.checkData(0, 3, "5")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 1 then # TSIM: if $data04 != 1 then
@ -2065,13 +2069,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 1 then # TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)') tdLog.info('tdSql.checkData(0, 2, "1")')
tdSql.checkData(0, 2, 1) tdSql.checkData(0, 2, "1")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 4 then # TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)') tdLog.info('tdSql.checkData(0, 3, "4")')
tdSql.checkData(0, 3, 4) tdSql.checkData(0, 3, "4")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 0 then # TSIM: if $data04 != 0 then
@ -2081,7 +2085,11 @@ class TDTestCase:
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != NULL then # TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)') tdLog.info('tdSql.checkData(0, 5, NULL)')
tdSql.checkData(0, 5, None) try:
tdSql.checkData(0, 5, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -2115,8 +2123,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 4 then # TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)') tdLog.info('tdSql.checkData(0, 3, "4")')
tdSql.checkData(0, 3, 4) tdSql.checkData(0, 3, "4")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 5 then # TSIM: if $data04 != 5 then
@ -2125,8 +2133,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 6 then # TSIM: if $data05 != 6 then
tdLog.info('tdSql.checkData(0, 5, 6)') tdLog.info('tdSql.checkData(0, 5, "6")')
tdSql.checkData(0, 5, 6) tdSql.checkData(0, 5, "6")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 7 then # TSIM: if $data06 != 7 then
@ -2171,13 +2179,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 1 then # TSIM: if $data03 != 1 then
tdLog.info('tdSql.checkData(0, 3, 1)') tdLog.info('tdSql.checkData(0, 3, "1")')
tdSql.checkData(0, 3, 1) tdSql.checkData(0, 3, "1")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 5 then # TSIM: if $data04 != 5 then
tdLog.info('tdSql.checkData(0, 4, 5)') tdLog.info('tdSql.checkData(0, 4, "5")')
tdSql.checkData(0, 4, 5) tdSql.checkData(0, 4, "5")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 4 then # TSIM: if $data05 != 4 then
@ -2186,8 +2194,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 3 then # TSIM: if $data06 != 3 then
tdLog.info('tdSql.checkData(0, 6, 3)') tdLog.info('tdSql.checkData(0, 6, "3")')
tdSql.checkData(0, 6, 3) tdSql.checkData(0, 6, "3")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != 2 then # TSIM: if $data07 != 2 then
@ -2257,8 +2265,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 7 then # TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)') tdLog.info('tdSql.checkData(0, 2, "7")')
tdSql.checkData(0, 2, 7) tdSql.checkData(0, 2, "7")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 9 then # TSIM: if $data03 != 9 then
@ -2272,8 +2280,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 8 then # TSIM: if $data05 != 8 then
tdLog.info('tdSql.checkData(0, 5, 8)') tdLog.info('tdSql.checkData(0, 5, "8")')
tdSql.checkData(0, 5, 8) tdSql.checkData(0, 5, "8")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 10 then # TSIM: if $data06 != 10 then
@ -2290,8 +2298,8 @@ class TDTestCase:
# TSIM: print =============== clear # TSIM: print =============== clear
tdLog.info('=============== clear') tdLog.info('=============== clear')
# TSIM: sql drop database $db # TSIM: sql drop database $db
tdLog.info('sql drop database $db') tdLog.info('drop database db')
tdSql.execute('sql drop database $db') tdSql.execute('drop database db')
# TSIM: sql show databases # TSIM: sql show databases
tdLog.info('show databases') tdLog.info('show databases')
tdSql.query('show databases') tdSql.query('show databases')

View File

@ -208,14 +208,14 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data23 != 1 then # TSIM: if $data23 != 1 then
tdLog.info('tdSql.checkData(2, 3, 1)') tdLog.info('tdSql.checkData(2, 3, "TAG")')
tdSql.checkData(2, 3, 1) tdSql.checkData(2, 3, "TAG")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql alter table $mt drop tag tgcol1 -x step40 # TSIM: sql alter table $mt drop tag tgcol1 -x step40
tdLog.info('alter table %s drop tag tgcol1 -x step40' % (mt)) tdLog.info('alter table %s drop tag tgcol1 -x step40' % (mt))
tdSql.error('alter table %s drop tag tgcol10' % (mt)) tdSql.error('alter table %s drop tag tgcol1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step40: # TSIM: step40:
# TSIM: sql alter table $mt drop tag tgcol2 # TSIM: sql alter table $mt drop tag tgcol2
@ -263,14 +263,14 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 2 then # TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)') tdLog.info('tdSql.checkData(0, 3, "2")')
tdSql.checkData(0, 3, 2) tdSql.checkData(0, 3, "2")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql alter table $mt drop tag tgcol1 -x step50 # TSIM: sql alter table $mt drop tag tgcol1 -x step50
tdLog.info('alter table %s drop tag tgcol1 -x step50' % (mt)) tdLog.info('alter table %s drop tag tgcol1 -x step50' % (mt))
tdSql.error('alter table %s drop tag tgcol10' % (mt)) tdSql.error('alter table %s drop tag tgcol1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step50: # TSIM: step50:
# TSIM: sql alter table $mt drop tag tgcol2 # TSIM: sql alter table $mt drop tag tgcol2
@ -381,8 +381,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 3 then # TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)') tdLog.info('tdSql.checkData(0, 4, "3")')
tdSql.checkData(0, 4, 3) tdSql.checkData(0, 4, "3")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -420,18 +420,18 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data23 != 1 then # TSIM: if $data23 != 1 then
tdLog.info('tdSql.checkData(2, 3, 1)') tdLog.info('tdSql.checkData(2, 3, "TAG")')
tdSql.checkData(2, 3, 1) tdSql.checkData(2, 3, "TAG")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data33 != 2 then # TSIM: if $data33 != 2 then
tdLog.info('tdSql.checkData(3, 3, 2)') tdLog.info('tdSql.checkData(3, 3, "TAG")')
tdSql.checkData(3, 3, 2) tdSql.checkData(3, 3, "TAG")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data43 != 3 then # TSIM: if $data43 != 3 then
tdLog.info('tdSql.checkData(4, 3, 3)') tdLog.info('tdSql.checkData(4, 3, "TAG")')
tdSql.checkData(4, 3, 3) tdSql.checkData(4, 3, "TAG")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -488,8 +488,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 3 then # TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)') tdLog.info('tdSql.checkData(0, 4, "3")')
tdSql.checkData(0, 4, 3) tdSql.checkData(0, 4, "3")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -543,13 +543,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 2 then # TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)') tdLog.info('tdSql.checkData(0, 3, "2")')
tdSql.checkData(0, 3, 2) tdSql.checkData(0, 3, "2")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 3 then # TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)') tdLog.info('tdSql.checkData(0, 4, "3")')
tdSql.checkData(0, 4, 3) tdSql.checkData(0, 4, "3")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -600,23 +600,23 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 1 then # TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)') tdLog.info('tdSql.checkData(0, 2, "1")')
tdSql.checkData(0, 2, 1) tdSql.checkData(0, 2, "1")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 2 then # TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)') tdLog.info('tdSql.checkData(0, 3, "2")')
tdSql.checkData(0, 3, 2) tdSql.checkData(0, 3, "2")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 3 then # TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)') tdLog.info('tdSql.checkData(0, 4, "3")')
tdSql.checkData(0, 4, 3) tdSql.checkData(0, 4, "3")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 4 then # TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)') tdLog.info('tdSql.checkData(0, 5, "4")')
tdSql.checkData(0, 5, 4) tdSql.checkData(0, 5, "4")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -690,8 +690,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 5 then # TSIM: if $data06 != 5 then
tdLog.info('tdSql.checkData(0, 6, 5)') tdLog.info('tdSql.checkData(0, 6, "5")')
tdSql.checkData(0, 6, 5) tdSql.checkData(0, 6, "5")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -766,13 +766,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 5 then # TSIM: if $data06 != 5 then
tdLog.info('tdSql.checkData(0, 6, 5)') tdLog.info('tdSql.checkData(0, 6, "5")')
tdSql.checkData(0, 6, 5) tdSql.checkData(0, 6, "5")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != 6 then # TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, 6)') tdLog.info('tdSql.checkData(0, 7, "6")')
tdSql.checkData(0, 7, 6) tdSql.checkData(0, 7, "6")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -830,8 +830,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 1 then # TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)') tdLog.info('tdSql.checkData(0, 2, "1")')
tdSql.checkData(0, 2, 1) tdSql.checkData(0, 2, "1")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 2 then # TSIM: if $data03 != 2 then
@ -845,8 +845,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 4 then # TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)') tdLog.info('tdSql.checkData(0, 5, "4")')
tdSql.checkData(0, 5, 4) tdSql.checkData(0, 5, "4")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 5.000000000 then # TSIM: if $data06 != 5.000000000 then
@ -855,8 +855,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != 6 then # TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, 6)') tdLog.info('tdSql.checkData(0, 7, "6")')
tdSql.checkData(0, 7, 6) tdSql.checkData(0, 7, "6")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -903,7 +903,11 @@ class TDTestCase:
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != NULL then # TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)') tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None) try:
tdSql.checkData(0, 3, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -944,7 +948,11 @@ class TDTestCase:
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != NULL then # TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)') tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None) try:
tdSql.checkData(0, 3, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -985,7 +993,11 @@ class TDTestCase:
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != NULL then # TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)') tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None) try:
tdSql.checkData(0, 3, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -1026,7 +1038,11 @@ class TDTestCase:
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != NULL then # TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)') tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None) try:
tdSql.checkData(0, 3, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -1067,23 +1083,27 @@ class TDTestCase:
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != NULL then # TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)') tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None) try:
tdSql.checkData(0, 3, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != NULL then # TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)') tdLog.info('tdSql.checkData(0, 4, NULL) out of range')
tdSql.checkData(0, 4, None) # tdSql.checkData(0, 4, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step51 # TSIM: sql select * from $mt where tgcol2 = 1 -x step51
tdLog.info('select * from %s where tgcol2 = 1 -x step51' % (mt)) tdLog.info('select * from %s where tgcol2 = 1 -x step51' % (mt))
tdSql.error('select * from %s where tgcol2 = 11' % (mt)) tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step51: # TSIM: step51:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step52 # TSIM: sql select * from $mt where tgcol3 = 1 -x step52
tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt)) tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt))
tdSql.error('select * from %s where tgcol3 = 12' % (mt)) tdSql.error('select * from %s where tgcol3 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step52: # TSIM: step52:
# TSIM: # TSIM:
@ -1118,23 +1138,27 @@ class TDTestCase:
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != NULL then # TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)') tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None) try:
tdSql.checkData(0, 3, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != NULL then # TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)') tdLog.info('tdSql.checkData(0, 4, NULL) out of range')
tdSql.checkData(0, 4, None) # tdSql.checkData(0, 4, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step71 # TSIM: sql select * from $mt where tgcol2 = 1 -x step71
tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt)) tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt))
tdSql.error('select * from %s where tgcol2 = 11' % (mt)) tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step71: # TSIM: step71:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step72 # TSIM: sql select * from $mt where tgcol3 = 1 -x step72
tdLog.info('select * from %s where tgcol3 = 1 -x step72' % (mt)) tdLog.info('select * from %s where tgcol3 = 1 -x step72' % (mt))
tdSql.error('select * from %s where tgcol3 = 12' % (mt)) tdSql.error('select * from %s where tgcol3 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step72: # TSIM: step72:
# TSIM: # TSIM:
@ -1169,23 +1193,27 @@ class TDTestCase:
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != NULL then # TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)') tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None) try:
tdSql.checkData(0, 3, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != NULL then # TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)') tdLog.info('tdSql.checkData(0, 4, NULL) out of range')
tdSql.checkData(0, 4, None) # tdSql.checkData(0, 4, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step81 # TSIM: sql select * from $mt where tgcol2 = 1 -x step81
tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt)) tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt))
tdSql.error('select * from %s where tgcol2 = 11' % (mt)) tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step81: # TSIM: step81:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step82 # TSIM: sql select * from $mt where tgcol3 = 1 -x step82
tdLog.info('select * from %s where tgcol3 = 1 -x step82' % (mt)) tdLog.info('select * from %s where tgcol3 = 1 -x step82' % (mt))
tdSql.error('select * from %s where tgcol3 = 12' % (mt)) tdSql.error('select * from %s where tgcol3 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step82: # TSIM: step82:
# TSIM: # TSIM:
@ -1220,23 +1248,27 @@ class TDTestCase:
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != NULL then # TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)') tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None) try:
tdSql.checkData(0, 3, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != NULL then # TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)') tdLog.info('tdSql.checkData(0, 4, NULL) out of range')
tdSql.checkData(0, 4, None) # tdSql.checkData(0, 4, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step91 # TSIM: sql select * from $mt where tgcol3 = 1 -x step91
tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt)) tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt))
tdSql.error('select * from %s where tgcol3 = 11' % (mt)) tdSql.error('select * from %s where tgcol3 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step91: # TSIM: step91:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step92 # TSIM: sql select * from $mt where tgcol2 = 1 -x step92
tdLog.info('select * from %s where tgcol2 = 1 -x step92' % (mt)) tdLog.info('select * from %s where tgcol2 = 1 -x step92' % (mt))
tdSql.error('select * from %s where tgcol2 = 12' % (mt)) tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step92: # TSIM: step92:
# TSIM: # TSIM:
@ -1265,39 +1297,43 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 1 then # TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)') tdLog.info('tdSql.checkData(0, 2, "1")')
tdSql.checkData(0, 2, 1) tdSql.checkData(0, 2, "1")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != NULL then # TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)') tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None) try:
tdSql.checkData(0, 3, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != NULL then # TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)') tdLog.info('tdSql.checkData(0, 4, NULL) out of range')
tdSql.checkData(0, 4, None) # tdSql.checkData(0, 4, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != NULL then # TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)') tdLog.info('tdSql.checkData(0, 5, NULL) out of range')
tdSql.checkData(0, 5, None) # tdSql.checkData(0, 5, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step101 # TSIM: sql select * from $mt where tgcol2 = 1 -x step101
tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt)) tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt))
tdSql.error('select * from %s where tgcol2 = 101' % (mt)) tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step101: # TSIM: step101:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step102 # TSIM: sql select * from $mt where tgcol3 = 1 -x step102
tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt)) tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt))
tdSql.error('select * from %s where tgcol3 = 102' % (mt)) tdSql.error('select * from %s where tgcol3 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step102: # TSIM: step102:
# TSIM: sql select * from $mt where tgcol4 = 1 -x step103 # TSIM: sql select * from $mt where tgcol4 = 1 -x step103
tdLog.info('select * from %s where tgcol4 = 1 -x step103' % (mt)) tdLog.info('select * from %s where tgcol4 = 1 -x step103' % (mt))
tdSql.error('select * from %s where tgcol4 = 103' % (mt)) tdSql.error('select * from %s where tgcol4 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step103: # TSIM: step103:
# TSIM: # TSIM:
@ -1336,34 +1372,34 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != NULL then # TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)') tdLog.info('tdSql.checkData(0, 4, NULL) out of range')
tdSql.checkData(0, 4, None) # tdSql.checkData(0, 4, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != NULL then # TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)') tdLog.info('tdSql.checkData(0, 5, NULL) out of range')
tdSql.checkData(0, 5, None) # tdSql.checkData(0, 5, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != NULL then # TSIM: if $data06 != NULL then
tdLog.info('tdSql.checkData(0, 6, NULL)') tdLog.info('tdSql.checkData(0, 6, NULL) out of range')
tdSql.checkData(0, 6, None) # tdSql.checkData(0, 6, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step111 # TSIM: sql select * from $mt where tgcol2 = 1 -x step111
tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt)) tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt))
tdSql.error('select * from %s where tgcol2 = 111' % (mt)) tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step111: # TSIM: step111:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step112 # TSIM: sql select * from $mt where tgcol3 = 1 -x step112
tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt)) tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt))
tdSql.error('select * from %s where tgcol3 = 112' % (mt)) tdSql.error('select * from %s where tgcol3 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step112: # TSIM: step112:
# TSIM: sql select * from $mt where tgcol5 = 1 -x step113 # TSIM: sql select * from $mt where tgcol5 = 1 -x step113
tdLog.info('select * from %s where tgcol5 = 1 -x step113' % (mt)) tdLog.info('select * from %s where tgcol5 = 1 -x step113' % (mt))
tdSql.error('select * from %s where tgcol5 = 113' % (mt)) tdSql.error('select * from %s where tgcol5 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step113: # TSIM: step113:
# TSIM: # TSIM:
@ -1402,44 +1438,44 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != NULL then # TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)') tdLog.info('tdSql.checkData(0, 4, NULL) out of range')
tdSql.checkData(0, 4, None) # tdSql.checkData(0, 4, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != NULL then # TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)') tdLog.info('tdSql.checkData(0, 5, NULL) out of range')
tdSql.checkData(0, 5, None) # tdSql.checkData(0, 5, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != NULL then # TSIM: if $data06 != NULL then
tdLog.info('tdSql.checkData(0, 6, NULL)') tdLog.info('tdSql.checkData(0, 6, NULL) out of range')
tdSql.checkData(0, 6, None) # tdSql.checkData(0, 6, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != NULL then # TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)') tdLog.info('tdSql.checkData(0, 7, NULL) out of range')
tdSql.checkData(0, 7, None) # tdSql.checkData(0, 7, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step120 # TSIM: sql select * from $mt where tgcol2 = 1 -x step120
tdLog.info('select * from %s where tgcol2 = 1 -x step120' % (mt)) tdLog.info('select * from %s where tgcol2 = 1 -x step120' % (mt))
tdSql.error('select * from %s where tgcol2 = 120' % (mt)) tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step120: # TSIM: step120:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step121 # TSIM: sql select * from $mt where tgcol3 = 1 -x step121
tdLog.info('select * from %s where tgcol3 = 1 -x step121' % (mt)) tdLog.info('select * from %s where tgcol3 = 1 -x step121' % (mt))
tdSql.error('select * from %s where tgcol3 = 121' % (mt)) tdSql.error('select * from %s where tgcol3 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step121: # TSIM: step121:
# TSIM: sql select * from $mt where tgcol5 = 1 -x step122 # TSIM: sql select * from $mt where tgcol5 = 1 -x step122
tdLog.info('select * from %s where tgcol5 = 1 -x step122' % (mt)) tdLog.info('select * from %s where tgcol5 = 1 -x step122' % (mt))
tdSql.error('select * from %s where tgcol5 = 122' % (mt)) tdSql.error('select * from %s where tgcol5 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step122: # TSIM: step122:
# TSIM: sql select * from $mt where tgcol6 = 1 -x step123 # TSIM: sql select * from $mt where tgcol6 = 1 -x step123
tdLog.info('select * from %s where tgcol6 = 1 -x step123' % (mt)) tdLog.info('select * from %s where tgcol6 = 1 -x step123' % (mt))
tdSql.error('select * from %s where tgcol6 = 123' % (mt)) tdSql.error('select * from %s where tgcol6 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step123: # TSIM: step123:
# TSIM: # TSIM:
@ -1471,8 +1507,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 1 then # TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)') tdLog.info('tdSql.checkData(0, 2, "1")')
tdSql.checkData(0, 2, 1) tdSql.checkData(0, 2, "1")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 2 then # TSIM: if $data03 != 2 then
@ -1486,34 +1522,34 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != NULL then # TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)') tdLog.info('tdSql.checkData(0, 5, NULL) out of range')
tdSql.checkData(0, 5, None) # tdSql.checkData(0, 5, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != NULL then # TSIM: if $data06 != NULL then
tdLog.info('tdSql.checkData(0, 6, NULL)') tdLog.info('tdSql.checkData(0, 6, NULL) out of range')
tdSql.checkData(0, 6, None) # tdSql.checkData(0, 6, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != NULL then # TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)') tdLog.info('tdSql.checkData(0, 7, NULL) out of range')
tdSql.checkData(0, 7, None) # tdSql.checkData(0, 7, None)
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step130 # TSIM: sql select * from $mt where tgcol3 = 1 -x step130
tdLog.info('select * from %s where tgcol3 = 1 -x step130' % (mt)) tdLog.info('select * from %s where tgcol3 = 1 -x step130' % (mt))
tdSql.error('select * from %s where tgcol3 = 130' % (mt)) tdSql.error('select * from %s where tgcol3 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step130: # TSIM: step130:
# TSIM: sql select * from $mt where tgcol4 = 1 -x step131 # TSIM: sql select * from $mt where tgcol4 = 1 -x step131
tdLog.info('select * from %s where tgcol4 = 1 -x step131' % (mt)) tdLog.info('select * from %s where tgcol4 = 1 -x step131' % (mt))
tdSql.error('select * from %s where tgcol4 = 131' % (mt)) tdSql.error('select * from %s where tgcol4 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step131: # TSIM: step131:
# TSIM: sql select * from $mt where tgcol6 = 1 -x step133 # TSIM: sql select * from $mt where tgcol6 = 1 -x step133
tdLog.info('select * from %s where tgcol6 = 1 -x step133' % (mt)) tdLog.info('select * from %s where tgcol6 = 1 -x step133' % (mt))
tdSql.error('select * from %s where tgcol6 = 133' % (mt)) tdSql.error('select * from %s where tgcol6 = 1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step133: # TSIM: step133:
# TSIM: # TSIM:
@ -1542,23 +1578,23 @@ class TDTestCase:
# TSIM: # TSIM:
# TSIM: sql alter table xxmt drop tag tag1 -x step141 # TSIM: sql alter table xxmt drop tag tag1 -x step141
tdLog.info('alter table xxmt drop tag tag1 -x step141') tdLog.info('alter table xxmt drop tag tag1 -x step141')
tdSql.error('alter table xxmt drop tag tag141') tdSql.error('alter table xxmt drop tag tag1')
# TSIM: return -1 # TSIM: return -1
# TSIM: step141: # TSIM: step141:
# TSIM: sql alter table $tb drop tag tag1 -x step142 # TSIM: sql alter table $tb drop tag tag1 -x step142
tdLog.info('alter table %s drop tag tag1 -x step142' % (tb)) tdLog.info('alter table %s drop tag tag1 -x step142' % (tb))
tdSql.error('alter table %s drop tag tag142' % (tb)) tdSql.error('alter table %s drop tag tag1' % (tb))
# TSIM: return -1 # TSIM: return -1
# TSIM: step142: # TSIM: step142:
# TSIM: sql alter table $mt drop tag tag1 -x step143 # TSIM: sql alter table $mt drop tag tag1 -x step143
tdLog.info('alter table %s drop tag tag1 -x step143' % (mt)) tdLog.info('alter table %s drop tag tag1 -x step143' % (mt))
tdSql.error('alter table %s drop tag tag143' % (mt)) tdSql.error('alter table %s drop tag tag1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step143: # TSIM: step143:
# TSIM: # TSIM:
# TSIM: sql alter table $mt drop tag tagcol1 -x step144 # TSIM: sql alter table $mt drop tag tagcol1 -x step144
tdLog.info('alter table %s drop tag tagcol1 -x step144' % (mt)) tdLog.info('alter table %s drop tag tagcol1 -x step144' % (mt))
tdSql.error('alter table %s drop tag tagcol144' % (mt)) tdSql.error('alter table %s drop tag tagcol1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step144: # TSIM: step144:
# TSIM: # TSIM:
@ -1567,15 +1603,15 @@ class TDTestCase:
tdSql.execute('alter table %s drop tag tgcol2' % (mt)) tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol1 -x step145 # TSIM: sql alter table $mt drop tag tgcol1 -x step145
tdLog.info('alter table %s drop tag tgcol1 -x step145' % (mt)) tdLog.info('alter table %s drop tag tgcol1 -x step145' % (mt))
tdSql.error('alter table %s drop tag tgcol145' % (mt)) tdSql.error('alter table %s drop tag tgcol1' % (mt))
# TSIM: return -1 # TSIM: return -1
# TSIM: step145: # TSIM: step145:
# TSIM: # TSIM:
# TSIM: print =============== clear # TSIM: print =============== clear
tdLog.info('=============== clear') tdLog.info('=============== clear')
# TSIM: sql drop database $db # TSIM: sql drop database $db
tdLog.info('sql drop database $db') tdLog.info('drop database db')
tdSql.execute('sql drop database $db') tdSql.execute('drop database db')
# TSIM: sql show databases # TSIM: sql show databases
tdLog.info('show databases') tdLog.info('show databases')
tdSql.query('show databases') tdSql.query('show databases')

View File

@ -178,13 +178,13 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data23 != false then # TSIM: if $data23 != false then
tdLog.info('tdSql.checkData(2, 3, false)') tdLog.info('tdSql.checkData(2, 3, "TAG")')
tdSql.checkData(2, 3, false) tdSql.checkData(2, 3, "TAG")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data33 != 4 then # TSIM: if $data33 != 4 then
tdLog.info('tdSql.checkData(3, 3, 4)') tdLog.info('tdSql.checkData(3, 3, "TAG")')
tdSql.checkData(3, 3, 4) tdSql.checkData(3, 3, "TAG")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -458,8 +458,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 2 then # TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)') tdLog.info('tdSql.checkData(0, 3, "2")')
tdSql.checkData(0, 3, 2) tdSql.checkData(0, 3, "2")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -495,8 +495,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 4 then # TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)') tdLog.info('tdSql.checkData(0, 3, "4")')
tdSql.checkData(0, 3, 4) tdSql.checkData(0, 3, "4")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -521,8 +521,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 4 then # TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)') tdLog.info('tdSql.checkData(0, 3, "4")')
tdSql.checkData(0, 3, 4) tdSql.checkData(0, 3, "4")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -567,8 +567,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 1 then # TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)') tdLog.info('tdSql.checkData(0, 2, "1")')
tdSql.checkData(0, 2, 1) tdSql.checkData(0, 2, "1")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 2 then # TSIM: if $data03 != 2 then
@ -582,8 +582,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 4 then # TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)') tdLog.info('tdSql.checkData(0, 5, "4")')
tdSql.checkData(0, 5, 4) tdSql.checkData(0, 5, "4")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 5.000000000 then # TSIM: if $data06 != 5.000000000 then
@ -592,8 +592,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != 6 then # TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, 6)') tdLog.info('tdSql.checkData(0, 7, "6")')
tdSql.checkData(0, 7, 6) tdSql.checkData(0, 7, "6")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -636,8 +636,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 7 then # TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)') tdLog.info('tdSql.checkData(0, 2, "7")')
tdSql.checkData(0, 2, 7) tdSql.checkData(0, 2, "7")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 8 then # TSIM: if $data03 != 8 then
@ -646,8 +646,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 9 then # TSIM: if $data04 != 9 then
tdLog.info('tdSql.checkData(0, 4, 9)') tdLog.info('tdSql.checkData(0, 4, "9")')
tdSql.checkData(0, 4, 9) tdSql.checkData(0, 4, "9")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 10.000000000 then # TSIM: if $data05 != 10.000000000 then
@ -656,13 +656,17 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 11 then # TSIM: if $data06 != 11 then
tdLog.info('tdSql.checkData(0, 6, 11)') tdLog.info('tdSql.checkData(0, 6, "11")')
tdSql.checkData(0, 6, 11) tdSql.checkData(0, 6, "11")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != NULL then # TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)') tdLog.info('tdSql.checkData(0, 7, NULL)')
tdSql.checkData(0, 7, None) try:
tdSql.checkData(0, 7, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -682,8 +686,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 7 then # TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)') tdLog.info('tdSql.checkData(0, 2, "7")')
tdSql.checkData(0, 2, 7) tdSql.checkData(0, 2, "7")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 8 then # TSIM: if $data03 != 8 then
@ -692,8 +696,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 9 then # TSIM: if $data04 != 9 then
tdLog.info('tdSql.checkData(0, 4, 9)') tdLog.info('tdSql.checkData(0, 4, "9")')
tdSql.checkData(0, 4, 9) tdSql.checkData(0, 4, "9")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 10.000000000 then # TSIM: if $data05 != 10.000000000 then
@ -702,13 +706,17 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 11 then # TSIM: if $data06 != 11 then
tdLog.info('tdSql.checkData(0, 6, 11)') tdLog.info('tdSql.checkData(0, 6, "11")')
tdSql.checkData(0, 6, 11) tdSql.checkData(0, 6, "11")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != NULL then # TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)') tdLog.info('tdSql.checkData(0, 7, NULL)')
tdSql.checkData(0, 7, None) try:
tdSql.checkData(0, 7, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -728,8 +736,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 7 then # TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)') tdLog.info('tdSql.checkData(0, 2, "7")')
tdSql.checkData(0, 2, 7) tdSql.checkData(0, 2, "7")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 8 then # TSIM: if $data03 != 8 then
@ -738,8 +746,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 9 then # TSIM: if $data04 != 9 then
tdLog.info('tdSql.checkData(0, 4, 9)') tdLog.info('tdSql.checkData(0, 4, "9")')
tdSql.checkData(0, 4, 9) tdSql.checkData(0, 4, "9")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 10.000000000 then # TSIM: if $data05 != 10.000000000 then
@ -748,13 +756,17 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 11 then # TSIM: if $data06 != 11 then
tdLog.info('tdSql.checkData(0, 6, 11)') tdLog.info('tdSql.checkData(0, 6, "11")')
tdSql.checkData(0, 6, 11) tdSql.checkData(0, 6, "11")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != NULL then # TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)') tdLog.info('tdSql.checkData(0, 7, NULL)')
tdSql.checkData(0, 7, None) try:
tdSql.checkData(0, 7, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -774,8 +786,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 7 then # TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)') tdLog.info('tdSql.checkData(0, 2, "7")')
tdSql.checkData(0, 2, 7) tdSql.checkData(0, 2, "7")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 8 then # TSIM: if $data03 != 8 then
@ -784,8 +796,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 9 then # TSIM: if $data04 != 9 then
tdLog.info('tdSql.checkData(0, 4, 9)') tdLog.info('tdSql.checkData(0, 4, "9")')
tdSql.checkData(0, 4, 9) tdSql.checkData(0, 4, "9")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 10.000000000 then # TSIM: if $data05 != 10.000000000 then
@ -794,13 +806,17 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 11 then # TSIM: if $data06 != 11 then
tdLog.info('tdSql.checkData(0, 6, 11)') tdLog.info('tdSql.checkData(0, 6, "11")')
tdSql.checkData(0, 6, 11) tdSql.checkData(0, 6, "11")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != NULL then # TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)') tdLog.info('tdSql.checkData(0, 7, NULL)')
tdSql.checkData(0, 7, None) try:
tdSql.checkData(0, 7, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
@ -820,8 +836,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data02 != 7 then # TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)') tdLog.info('tdSql.checkData(0, 2, "7")')
tdSql.checkData(0, 2, 7) tdSql.checkData(0, 2, "7")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data03 != 8 then # TSIM: if $data03 != 8 then
@ -830,8 +846,8 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data04 != 9 then # TSIM: if $data04 != 9 then
tdLog.info('tdSql.checkData(0, 4, 9)') tdLog.info('tdSql.checkData(0, 4, "9")')
tdSql.checkData(0, 4, 9) tdSql.checkData(0, 4, "9")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data05 != 10.000000000 then # TSIM: if $data05 != 10.000000000 then
@ -840,21 +856,25 @@ class TDTestCase:
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data06 != 11 then # TSIM: if $data06 != 11 then
tdLog.info('tdSql.checkData(0, 6, 11)') tdLog.info('tdSql.checkData(0, 6, "11")')
tdSql.checkData(0, 6, 11) tdSql.checkData(0, 6, "11")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: if $data07 != NULL then # TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)') tdLog.info('tdSql.checkData(0, 7, NULL)')
tdSql.checkData(0, 7, None) try:
tdSql.checkData(0, 7, None)
except Exception as e:
tdLog.info(repr(e))
tdLog.info("out of range")
# TSIM: return -1 # TSIM: return -1
# TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== clear # TSIM: print =============== clear
tdLog.info('=============== clear') tdLog.info('=============== clear')
# TSIM: sql drop database $db # TSIM: sql drop database $db
tdLog.info('sql drop database $db') tdLog.info('drop database db')
tdSql.execute('sql drop database $db') tdSql.execute('drop database db')
# TSIM: sql show databases # TSIM: sql show databases
tdLog.info('show databases') tdLog.info('show databases')
tdSql.query('show databases') tdSql.query('show databases')

View File

@ -215,31 +215,37 @@ class TDSql:
if col < 0: if col < 0:
tdLog.exit( tdLog.exit(
"%s failed: sql:%s, col:%d is smaller than zero" % "%s failed: sql:%s, col:%d is smaller than zero" %
(callerFilename, self.sql, col)) (callerFilename, self.sql, col))
if col > self.queryCols: if col > self.queryCols:
tdLog.exit( tdLog.exit(
"%s failed: sql:%s, col:%d is larger than queryCols:%d" % "%s failed: sql:%s, col:%d is larger than queryCols:%d" %
(callerFilename, self.sql, col, self.queryCols)) (callerFilename, self.sql, col, self.queryCols))
matrix = np.array(self.queryResult)
list = matrix[:, 0]
if order == "" or order.upper() == "ASC": matrix = np.array(self.queryResult)
if all(sorted(list) == list): list = matrix[:, 0]
tdLog.info("sql:%s, column :%d is sorted in accending order as expected" %
if order == "" or order.upper() == "ASC":
if all(sorted(list) == list):
tdLog.info(
"sql:%s, column :%d is sorted in accending order as expected" %
(self.sql, col)) (self.sql, col))
else: else:
tdLog.exit("%s failed: sql:%s, col:%d is not sorted in accesnind order" % tdLog.exit(
"%s failed: sql:%s, col:%d is not sorted in accesnind order" %
(callerFilename, self.sql, col)) (callerFilename, self.sql, col))
elif order.upper() == "DESC": elif order.upper() == "DESC":
if all(sorted(list, reverse=True) == list): if all(sorted(list, reverse=True) == list):
tdLog.info("sql:%s, column :%d is sorted in decending order as expected" % tdLog.info(
"sql:%s, column :%d is sorted in decending order as expected" %
(self.sql, col)) (self.sql, col))
else: else:
tdLog.exit("%s failed: sql:%s, col:%d is not sorted in decending order" % tdLog.exit(
(callerFilename, self.sql, col)) "%s failed: sql:%s, col:%d is not sorted in decending order" %
(callerFilename, self.sql, col))
else: else:
tdLog.exit("%s failed: sql:%s, the order provided for col:%d is not correct" % tdLog.exit(
(callerFilename, self.sql, col)) "%s failed: sql:%s, the order provided for col:%d is not correct" %
(callerFilename, self.sql, col))
tdSql = TDSql() tdSql = TDSql()

View File

@ -177,7 +177,7 @@ if $data00 != $totalRows then
return -1 return -1
endi endi
print ============== step5: stop dnode2, and check if dnode3 sync ok print ============== step5: stop dnode2, and check if dnode3 sync ok
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT
sleep $sleepTimer sleep $sleepTimer
wait_dnode2_offline_0: wait_dnode2_offline_0:
@ -224,3 +224,9 @@ if $dnode3Vtatus != master then
sleep 2000 sleep 2000
goto wait_dnode3_vgroup_master goto wait_dnode3_vgroup_master
endi endi
sql select count(*) from $stb
print data00 $data00
if $data00 != $totalRows then
return -1
endi

View File

@ -105,7 +105,7 @@ if $data00 != $totalRows then
return -1 return -1
endi endi
print ============== step5: stop dnode2, and check if dnode3 sync ok print ============== step5: stop dnode2, and check if dnode3 sync ok
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT
sleep $sleepTimer sleep $sleepTimer
wait_dnode2_offline_0: wait_dnode2_offline_0:
@ -152,3 +152,9 @@ if $dnode3Vtatus != master then
sleep 2000 sleep 2000
goto wait_dnode3_vgroup_master goto wait_dnode3_vgroup_master
endi endi
sql select count(*) from $stb
print data00 $data00
if $data00 != $totalRows then
return -1
endi