提交 03161e35 编写于 作者: H Hongze Cheng

Merge branch 'develop' into feature/2.0tsdb

...@@ -26,6 +26,7 @@ matrix: ...@@ -26,6 +26,7 @@ matrix:
- python3-pip - python3-pip
- python3-setuptools - python3-setuptools
- valgrind - valgrind
- psmisc
before_script: before_script:
- cd ${TRAVIS_BUILD_DIR} - cd ${TRAVIS_BUILD_DIR}
...@@ -142,6 +143,7 @@ matrix: ...@@ -142,6 +143,7 @@ matrix:
- python3-pip - python3-pip
- python3-setuptools - python3-setuptools
- lcov - lcov
- psmisc
before_script: before_script:
- cd ${TRAVIS_BUILD_DIR} - cd ${TRAVIS_BUILD_DIR}
......
from .cinterface import CTaosInterface from .cinterface import CTaosInterface
from .error import * from .error import *
from .constants import FieldType
class TDengineCursor(object): class TDengineCursor(object):
"""Database cursor which is used to manage the context of a fetch operation. """Database cursor which is used to manage the context of a fetch operation.
...@@ -44,7 +46,8 @@ class TDengineCursor(object): ...@@ -44,7 +46,8 @@ class TDengineCursor(object):
raise OperationalError("Invalid use of fetch iterator") raise OperationalError("Invalid use of fetch iterator")
if self._block_rows <= self._block_iter: if self._block_rows <= self._block_iter:
block, self._block_rows = CTaosInterface.fetchBlock(self._result, self._fields) block, self._block_rows = CTaosInterface.fetchBlock(
self._result, self._fields)
if self._block_rows == 0: if self._block_rows == 0:
raise StopIteration raise StopIteration
self._block = list(map(tuple, zip(*block))) self._block = list(map(tuple, zip(*block)))
...@@ -112,13 +115,17 @@ class TDengineCursor(object): ...@@ -112,13 +115,17 @@ class TDengineCursor(object):
res = CTaosInterface.query(self._connection._conn, stmt) res = CTaosInterface.query(self._connection._conn, stmt)
if res == 0: if res == 0:
if CTaosInterface.fieldsCount(self._connection._conn) == 0: if CTaosInterface.fieldsCount(self._connection._conn) == 0:
self._affected_rows += CTaosInterface.affectedRows(self._connection._conn) self._affected_rows += CTaosInterface.affectedRows(
self._connection._conn)
return CTaosInterface.affectedRows(self._connection._conn) return CTaosInterface.affectedRows(self._connection._conn)
else: else:
self._result, self._fields = CTaosInterface.useResult(self._connection._conn) self._result, self._fields = CTaosInterface.useResult(
self._connection._conn)
return self._handle_result() return self._handle_result()
else: else:
raise ProgrammingError(CTaosInterface.errStr(self._connection._conn)) raise ProgrammingError(
CTaosInterface.errStr(
self._connection._conn))
def executemany(self, operation, seq_of_parameters): def executemany(self, operation, seq_of_parameters):
"""Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters. """Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters.
...@@ -130,6 +137,37 @@ class TDengineCursor(object): ...@@ -130,6 +137,37 @@ class TDengineCursor(object):
""" """
pass pass
def istype(self, col, dataType):
if (dataType.upper() == "BOOL"):
if (self._description[col][1] == FieldType.C_BOOL):
return True
if (dataType.upper() == "TINYINT"):
if (self._description[col][1] == FieldType.C_TINYINT):
return True
if (dataType.upper() == "INT"):
if (self._description[col][1] == FieldType.C_INT):
return True
if (dataType.upper() == "BIGINT"):
if (self._description[col][1] == FieldType.C_INT):
return True
if (dataType.upper() == "FLOAT"):
if (self._description[col][1] == FieldType.C_FLOAT):
return True
if (dataType.upper() == "DOUBLE"):
if (self._description[col][1] == FieldType.C_DOUBLE):
return True
if (dataType.upper() == "BINARY"):
if (self._description[col][1] == FieldType.C_BINARY):
return True
if (dataType.upper() == "TIMESTAMP"):
if (self._description[col][1] == FieldType.C_TIMESTAMP):
return True
if (dataType.upper() == "NCHAR"):
if (self._description[col][1] == FieldType.C_NCHAR):
return True
return False
def fetchmany(self): def fetchmany(self):
pass pass
...@@ -142,8 +180,10 @@ class TDengineCursor(object): ...@@ -142,8 +180,10 @@ class TDengineCursor(object):
buffer = [[] for i in range(len(self._fields))] buffer = [[] for i in range(len(self._fields))]
self._rowcount = 0 self._rowcount = 0
while True: while True:
block, num_of_fields = CTaosInterface.fetchBlock(self._result, self._fields) block, num_of_fields = CTaosInterface.fetchBlock(
if num_of_fields == 0: break self._result, self._fields)
if num_of_fields == 0:
break
self._rowcount += num_of_fields self._rowcount += num_of_fields
for i in range(len(self._fields)): for i in range(len(self._fields)):
buffer[i].extend(block[i]) buffer[i].extend(block[i])
...@@ -152,8 +192,6 @@ class TDengineCursor(object): ...@@ -152,8 +192,6 @@ class TDengineCursor(object):
return list(map(tuple, zip(*buffer))) return list(map(tuple, zip(*buffer)))
def nextset(self): def nextset(self):
""" """
""" """
...@@ -182,6 +220,7 @@ class TDengineCursor(object): ...@@ -182,6 +220,7 @@ class TDengineCursor(object):
""" """
self._description = [] self._description = []
for ele in self._fields: for ele in self._fields:
self._description.append((ele['name'], ele['type'], None, None, None, None, False)) self._description.append(
(ele['name'], ele['type'], None, None, None, None, False))
return self._result return self._result
from .cinterface import CTaosInterface from .cinterface import CTaosInterface
from .error import * from .error import *
from .constants import FieldType
# querySeqNum = 0 # querySeqNum = 0
class TDengineCursor(object): class TDengineCursor(object):
"""Database cursor which is used to manage the context of a fetch operation. """Database cursor which is used to manage the context of a fetch operation.
...@@ -46,7 +48,8 @@ class TDengineCursor(object): ...@@ -46,7 +48,8 @@ class TDengineCursor(object):
raise OperationalError("Invalid use of fetch iterator") raise OperationalError("Invalid use of fetch iterator")
if self._block_rows <= self._block_iter: if self._block_rows <= self._block_iter:
block, self._block_rows = CTaosInterface.fetchBlock(self._result, self._fields) block, self._block_rows = CTaosInterface.fetchBlock(
self._result, self._fields)
if self._block_rows == 0: if self._block_rows == 0:
raise StopIteration raise StopIteration
self._block = list(map(tuple, zip(*block))) self._block = list(map(tuple, zip(*block)))
...@@ -111,7 +114,6 @@ class TDengineCursor(object): ...@@ -111,7 +114,6 @@ class TDengineCursor(object):
if params is not None: if params is not None:
pass pass
# global querySeqNum # global querySeqNum
# querySeqNum += 1 # querySeqNum += 1
# localSeqNum = querySeqNum # avoid raice condition # localSeqNum = querySeqNum # avoid raice condition
...@@ -121,13 +123,17 @@ class TDengineCursor(object): ...@@ -121,13 +123,17 @@ class TDengineCursor(object):
if res == 0: if res == 0:
if CTaosInterface.fieldsCount(self._connection._conn) == 0: if CTaosInterface.fieldsCount(self._connection._conn) == 0:
self._affected_rows += CTaosInterface.affectedRows(self._connection._conn) self._affected_rows += CTaosInterface.affectedRows(
self._connection._conn)
return CTaosInterface.affectedRows(self._connection._conn) return CTaosInterface.affectedRows(self._connection._conn)
else: else:
self._result, self._fields = CTaosInterface.useResult(self._connection._conn) self._result, self._fields = CTaosInterface.useResult(
self._connection._conn)
return self._handle_result() return self._handle_result()
else: else:
raise ProgrammingError(CTaosInterface.errStr(self._connection._conn)) raise ProgrammingError(
CTaosInterface.errStr(
self._connection._conn))
def executemany(self, operation, seq_of_parameters): def executemany(self, operation, seq_of_parameters):
"""Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters. """Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters.
...@@ -142,6 +148,37 @@ class TDengineCursor(object): ...@@ -142,6 +148,37 @@ class TDengineCursor(object):
def fetchmany(self): def fetchmany(self):
pass pass
def istype(self, col, dataType):
if (dataType.upper() == "BOOL"):
if (self._description[col][1] == FieldType.C_BOOL):
return True
if (dataType.upper() == "TINYINT"):
if (self._description[col][1] == FieldType.C_TINYINT):
return True
if (dataType.upper() == "INT"):
if (self._description[col][1] == FieldType.C_INT):
return True
if (dataType.upper() == "BIGINT"):
if (self._description[col][1] == FieldType.C_INT):
return True
if (dataType.upper() == "FLOAT"):
if (self._description[col][1] == FieldType.C_FLOAT):
return True
if (dataType.upper() == "DOUBLE"):
if (self._description[col][1] == FieldType.C_DOUBLE):
return True
if (dataType.upper() == "BINARY"):
if (self._description[col][1] == FieldType.C_BINARY):
return True
if (dataType.upper() == "TIMESTAMP"):
if (self._description[col][1] == FieldType.C_TIMESTAMP):
return True
if (dataType.upper() == "NCHAR"):
if (self._description[col][1] == FieldType.C_NCHAR):
return True
return False
def fetchall(self): def fetchall(self):
"""Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g. a list of tuples). Note that the cursor's arraysize attribute can affect the performance of this operation. """Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g. a list of tuples). Note that the cursor's arraysize attribute can affect the performance of this operation.
""" """
...@@ -151,8 +188,10 @@ class TDengineCursor(object): ...@@ -151,8 +188,10 @@ class TDengineCursor(object):
buffer = [[] for i in range(len(self._fields))] buffer = [[] for i in range(len(self._fields))]
self._rowcount = 0 self._rowcount = 0
while True: while True:
block, num_of_fields = CTaosInterface.fetchBlock(self._result, self._fields) block, num_of_fields = CTaosInterface.fetchBlock(
if num_of_fields == 0: break self._result, self._fields)
if num_of_fields == 0:
break
self._rowcount += num_of_fields self._rowcount += num_of_fields
for i in range(len(self._fields)): for i in range(len(self._fields)):
buffer[i].extend(block[i]) buffer[i].extend(block[i])
...@@ -161,8 +200,6 @@ class TDengineCursor(object): ...@@ -161,8 +200,6 @@ class TDengineCursor(object):
return list(map(tuple, zip(*buffer))) return list(map(tuple, zip(*buffer)))
def nextset(self): def nextset(self):
""" """
""" """
...@@ -191,6 +228,7 @@ class TDengineCursor(object): ...@@ -191,6 +228,7 @@ class TDengineCursor(object):
""" """
self._description = [] self._description = []
for ele in self._fields: for ele in self._fields:
self._description.append((ele['name'], ele['type'], None, None, None, None, False)) self._description.append(
(ele['name'], ele['type'], None, None, None, None, False))
return self._result return self._result
...@@ -95,7 +95,7 @@ typedef void* tsync_h; ...@@ -95,7 +95,7 @@ typedef void* tsync_h;
tsync_h syncStart(const SSyncInfo *); tsync_h syncStart(const SSyncInfo *);
void syncStop(tsync_h shandle); void syncStop(tsync_h shandle);
int syncReconfig(tsync_h shandle, const SSyncCfg *); int syncReconfig(tsync_h shandle, const SSyncCfg *);
int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle); int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle, int qtype);
void syncConfirmForward(tsync_h shandle, uint64_t version, int32_t code); void syncConfirmForward(tsync_h shandle, uint64_t version, int32_t code);
void syncRecover(tsync_h shandle); // recover from other nodes: void syncRecover(tsync_h shandle); // recover from other nodes:
int syncGetNodesRole(tsync_h shandle, SNodesRole *); int syncGetNodesRole(tsync_h shandle, SNodesRole *);
......
...@@ -227,7 +227,7 @@ static void sdbConfirmForward(void *ahandle, void *param, int32_t code) { ...@@ -227,7 +227,7 @@ static void sdbConfirmForward(void *ahandle, void *param, int32_t code) {
static int32_t sdbForwardToPeer(SWalHead *pHead) { static int32_t sdbForwardToPeer(SWalHead *pHead) {
if (tsSdbObj.sync == NULL) return TSDB_CODE_SUCCESS; if (tsSdbObj.sync == NULL) return TSDB_CODE_SUCCESS;
int32_t code = syncForwardToPeer(tsSdbObj.sync, pHead, (void*)pHead->version); int32_t code = syncForwardToPeer(tsSdbObj.sync, pHead, (void*)pHead->version, TAOS_QTYPE_RPC);
if (code > 0) { if (code > 0) {
sdbTrace("forward request is sent, version:%" PRIu64 ", code:%d", pHead->version, code); sdbTrace("forward request is sent, version:%" PRIu64 ", code:%d", pHead->version, code);
sem_wait(&tsSdbObj.sem); sem_wait(&tsSdbObj.sem);
......
...@@ -269,7 +269,6 @@ static int32_t mgmtChildTableActionRestored() { ...@@ -269,7 +269,6 @@ static int32_t mgmtChildTableActionRestored() {
SChildTableObj *pTable = NULL; SChildTableObj *pTable = NULL;
while (1) { while (1) {
mgmtDecTableRef(pTable);
pIter = mgmtGetNextChildTable(pIter, &pTable); pIter = mgmtGetNextChildTable(pIter, &pTable);
if (pTable == NULL) break; if (pTable == NULL) break;
...@@ -278,6 +277,7 @@ static int32_t mgmtChildTableActionRestored() { ...@@ -278,6 +277,7 @@ static int32_t mgmtChildTableActionRestored() {
mError("ctable:%s, failed to get db, discard it", pTable->info.tableId); mError("ctable:%s, failed to get db, discard it", pTable->info.tableId);
SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb};
sdbDeleteRow(&desc); sdbDeleteRow(&desc);
mgmtDecTableRef(pTable);
continue; continue;
} }
mgmtDecDbRef(pDb); mgmtDecDbRef(pDb);
...@@ -288,6 +288,7 @@ static int32_t mgmtChildTableActionRestored() { ...@@ -288,6 +288,7 @@ static int32_t mgmtChildTableActionRestored() {
pTable->vgId = 0; pTable->vgId = 0;
SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb};
sdbDeleteRow(&desc); sdbDeleteRow(&desc);
mgmtDecTableRef(pTable);
continue; continue;
} }
mgmtDecVgroupRef(pVgroup); mgmtDecVgroupRef(pVgroup);
...@@ -298,6 +299,7 @@ static int32_t mgmtChildTableActionRestored() { ...@@ -298,6 +299,7 @@ static int32_t mgmtChildTableActionRestored() {
pTable->vgId = 0; pTable->vgId = 0;
SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb};
sdbDeleteRow(&desc); sdbDeleteRow(&desc);
mgmtDecTableRef(pTable);
continue; continue;
} }
...@@ -306,6 +308,7 @@ static int32_t mgmtChildTableActionRestored() { ...@@ -306,6 +308,7 @@ static int32_t mgmtChildTableActionRestored() {
pTable->vgId = 0; pTable->vgId = 0;
SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb};
sdbDeleteRow(&desc); sdbDeleteRow(&desc);
mgmtDecTableRef(pTable);
continue; continue;
} }
...@@ -316,10 +319,13 @@ static int32_t mgmtChildTableActionRestored() { ...@@ -316,10 +319,13 @@ static int32_t mgmtChildTableActionRestored() {
pTable->vgId = 0; pTable->vgId = 0;
SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb};
sdbDeleteRow(&desc); sdbDeleteRow(&desc);
mgmtDecTableRef(pTable);
continue; continue;
} }
mgmtDecTableRef(pSuperTable); mgmtDecTableRef(pSuperTable);
} }
mgmtDecTableRef(pTable);
} }
sdbFreeIter(pIter); sdbFreeIter(pIter);
...@@ -1136,19 +1142,20 @@ int32_t mgmtRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, v ...@@ -1136,19 +1142,20 @@ int32_t mgmtRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, v
char stableName[TSDB_TABLE_NAME_LEN] = {0}; char stableName[TSDB_TABLE_NAME_LEN] = {0};
while (numOfRows < rows) { while (numOfRows < rows) {
mgmtDecTableRef(pTable);
pShow->pIter = mgmtGetNextSuperTable(pShow->pIter, &pTable); pShow->pIter = mgmtGetNextSuperTable(pShow->pIter, &pTable);
if (pTable == NULL) break; if (pTable == NULL) break;
if (strncmp(pTable->info.tableId, prefix, prefixLen)) { if (strncmp(pTable->info.tableId, prefix, prefixLen)) {
mgmtDecTableRef(pTable);
continue; continue;
} }
memset(stableName, 0, tListLen(stableName)); memset(stableName, 0, tListLen(stableName));
mgmtExtractTableName(pTable->info.tableId, stableName); mgmtExtractTableName(pTable->info.tableId, stableName);
if (pShow->payloadLen > 0 && if (pShow->payloadLen > 0 && patternMatch(pShow->payload, stableName, TSDB_TABLE_NAME_LEN, &info) != TSDB_PATTERN_MATCH) {
patternMatch(pShow->payload, stableName, TSDB_TABLE_NAME_LEN, &info) != TSDB_PATTERN_MATCH) mgmtDecTableRef(pTable);
continue; continue;
}
cols = 0; cols = 0;
...@@ -1178,6 +1185,7 @@ int32_t mgmtRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, v ...@@ -1178,6 +1185,7 @@ int32_t mgmtRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, v
cols++; cols++;
numOfRows++; numOfRows++;
mgmtDecTableRef(pTable);
} }
pShow->numOfReads += numOfRows; pShow->numOfReads += numOfRows;
...@@ -1475,7 +1483,7 @@ static SChildTableObj* mgmtDoCreateChildTable(SCMCreateTableMsg *pCreate, SVgObj ...@@ -1475,7 +1483,7 @@ static SChildTableObj* mgmtDoCreateChildTable(SCMCreateTableMsg *pCreate, SVgObj
return NULL; return NULL;
} }
mTrace("table:%s, create table in vgroup, id:%d, uid:%" PRIu64 , pTable->info.tableId, pTable->sid, pTable->uid); mTrace("table:%s, create table in vgroup:%d, id:%d, uid:%" PRIu64 , pTable->info.tableId, pVgroup->vgId, pTable->sid, pTable->uid);
return pTable; return pTable;
} }
...@@ -2106,12 +2114,12 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows, ...@@ -2106,12 +2114,12 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows,
int32_t prefixLen = strlen(prefix); int32_t prefixLen = strlen(prefix);
while (numOfRows < rows) { while (numOfRows < rows) {
mgmtDecTableRef(pTable);
pShow->pIter = mgmtGetNextChildTable(pShow->pIter, &pTable); pShow->pIter = mgmtGetNextChildTable(pShow->pIter, &pTable);
if (pTable == NULL) break; if (pTable == NULL) break;
// not belong to current db // not belong to current db
if (strncmp(pTable->info.tableId, prefix, prefixLen)) { if (strncmp(pTable->info.tableId, prefix, prefixLen)) {
mgmtDecTableRef(pTable);
continue; continue;
} }
...@@ -2120,8 +2128,8 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows, ...@@ -2120,8 +2128,8 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows,
// pattern compare for table name // pattern compare for table name
mgmtExtractTableName(pTable->info.tableId, tableName); mgmtExtractTableName(pTable->info.tableId, tableName);
if (pShow->payloadLen > 0 && if (pShow->payloadLen > 0 && patternMatch(pShow->payload, tableName, TSDB_TABLE_NAME_LEN, &info) != TSDB_PATTERN_MATCH) {
patternMatch(pShow->payload, tableName, TSDB_TABLE_NAME_LEN, &info) != TSDB_PATTERN_MATCH) { mgmtDecTableRef(pTable);
continue; continue;
} }
...@@ -2156,6 +2164,7 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows, ...@@ -2156,6 +2164,7 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows,
cols++; cols++;
numOfRows++; numOfRows++;
mgmtDecTableRef(pTable);
} }
pShow->numOfReads += numOfRows; pShow->numOfReads += numOfRows;
......
...@@ -586,6 +586,7 @@ static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) { ...@@ -586,6 +586,7 @@ static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) {
} }
} }
taosArrayDestroy(res);
return 0; return 0;
} }
......
...@@ -1466,8 +1466,8 @@ static int tsdbReadRowsFromCache(SSkipListIterator* pIter, STable* pTable, TSKEY ...@@ -1466,8 +1466,8 @@ static int tsdbReadRowsFromCache(SSkipListIterator* pIter, STable* pTable, TSKEY
} }
} }
numOfRows++; if (++numOfRows >= maxRowsToRead) {
if (numOfRows >= maxRowsToRead) { tSkipListIterNext(pIter);
break; break;
} }
......
...@@ -416,12 +416,12 @@ void getTmpfilePath(const char *fileNamePrefix, char *dstPath) { ...@@ -416,12 +416,12 @@ void getTmpfilePath(const char *fileNamePrefix, char *dstPath) {
#else #else
char *tmpDir = "/tmp/"; char *tmpDir = "/tmp/";
#endif #endif
int64_t ts = taosGetTimestampUs();
strcpy(tmpPath, tmpDir); strcpy(tmpPath, tmpDir);
strcat(tmpPath, tdengineTmpFileNamePrefix); strcat(tmpPath, tdengineTmpFileNamePrefix);
strcat(tmpPath, fileNamePrefix); strcat(tmpPath, fileNamePrefix);
strcat(tmpPath, "-%llu-%u"); strcat(tmpPath, "-%d-%"PRIu64"-%u-%"PRIu64);
snprintf(dstPath, PATH_MAX, tmpPath, taosGetPthreadId(), atomic_add_fetch_32(&tmpFileSerialNum, 1)); snprintf(dstPath, PATH_MAX, tmpPath, getpid(), taosGetPthreadId(), atomic_add_fetch_32(&tmpFileSerialNum, 1), ts);
} }
int tasoUcs4Compare(void* f1_ucs4, void *f2_ucs4, int bytes) { int tasoUcs4Compare(void* f1_ucs4, void *f2_ucs4, int bytes) {
......
...@@ -46,7 +46,7 @@ static pthread_once_t vnodeModuleInit = PTHREAD_ONCE_INIT; ...@@ -46,7 +46,7 @@ static pthread_once_t vnodeModuleInit = PTHREAD_ONCE_INIT;
#ifndef _SYNC #ifndef _SYNC
tsync_h syncStart(const SSyncInfo *info) { return NULL; } tsync_h syncStart(const SSyncInfo *info) { return NULL; }
int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle) { return 0; } int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle, int qtype) { return 0; }
void syncStop(tsync_h shandle) {} void syncStop(tsync_h shandle) {}
int syncReconfig(tsync_h shandle, const SSyncCfg * cfg) { return 0; } int syncReconfig(tsync_h shandle, const SSyncCfg * cfg) { return 0; }
int syncGetNodesRole(tsync_h shandle, SNodesRole * cfg) { return 0; } int syncGetNodesRole(tsync_h shandle, SNodesRole * cfg) { return 0; }
......
...@@ -72,10 +72,9 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { ...@@ -72,10 +72,9 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
code = walWrite(pVnode->wal, pHead); code = walWrite(pVnode->wal, pHead);
if (code < 0) return code; if (code < 0) return code;
// forward to peers if data is from RPC or CQ // forward to peers, even it is WAL/FWD, it shall be called to update version in sync
int32_t syncCode = 0; int32_t syncCode = 0;
if (qtype == TAOS_QTYPE_RPC || qtype == TAOS_QTYPE_CQ) syncCode = syncForwardToPeer(pVnode->sync, pHead, item, qtype);
syncCode = syncForwardToPeer(pVnode->sync, pHead, item);
if (syncCode < 0) return syncCode; if (syncCode < 0) return syncCode;
// write data locally // write data locally
......
...@@ -22,6 +22,32 @@ python3 ./test.py $1 -f table/tablename-boundary.py ...@@ -22,6 +22,32 @@ python3 ./test.py $1 -f table/tablename-boundary.py
# tag # tag
python3 ./test.py $1 -f tag_lite/filter.py python3 ./test.py $1 -f tag_lite/filter.py
python3 ./test.py $1 -f tag_lite/create-tags-boundary.py python3 ./test.py $1 -f tag_lite/create-tags-boundary.py
python3 ./test.py $1 -f tag_lite/3.py
python3 ./test.py $1 -f tag_lite/4.py
python3 ./test.py $1 -f tag_lite/5.py
python3 ./test.py $1 -f tag_lite/6.py
python3 ./test.py $1 -f tag_lite/add.py
python3 ./test.py $1 -f tag_lite/bigint.py
python3 ./test.py $1 -f tag_lite/binary_binary.py
python3 ./test.py $1 -f tag_lite/binary.py
python3 ./test.py $1 -f tag_lite/bool_binary.py
python3 ./test.py $1 -f tag_lite/bool_int.py
python3 ./test.py $1 -f tag_lite/bool.py
python3 ./test.py $1 -f tag_lite/change.py
python3 ./test.py $1 -f tag_lite/column.py
python3 ./test.py $1 -f tag_lite/commit.py
python3 ./test.py $1 -f tag_lite/create.py
python3 ./test.py $1 -f tag_lite/datatype.py
python3 ./test.py $1 -f tag_lite/datatype-without-alter.py
python3 ./test.py $1 -f tag_lite/delete.py
python3 ./test.py $1 -f tag_lite/double.py
python3 ./test.py $1 -f tag_lite/float.py
python3 ./test.py $1 -f tag_lite/int_binary.py
python3 ./test.py $1 -f tag_lite/int_float.py
python3 ./test.py $1 -f tag_lite/int.py
python3 ./test.py $1 -f tag_lite/set.py
python3 ./test.py $1 -f tag_lite/smallint.py
python3 ./test.py $1 -f tag_lite/tinyint.py
python3 ./test.py $1 -f dbmgmt/database-name-boundary.py python3 ./test.py $1 -f dbmgmt/database-name-boundary.py
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512') tdSql.execute('create database db cache 128')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -33,7 +33,7 @@ class TDTestCase: ...@@ -33,7 +33,7 @@ class TDTestCase:
tdDnodes.start(1) tdDnodes.start(1)
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512 maxtables 10') tdSql.execute('create database db cache 128 maxtables 10')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def run(self):
tdSql.prepare()
# TSIM: system sh/stop_dnodes.sh
# TSIM:
# TSIM:
# TSIM: system sh/deploy.sh -n dnode1 -i 1
# TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0
# TSIM: system sh/exec.sh -n dnode1 -s start
# TSIM:
# TSIM: sleep 3000
# TSIM: sql connect
# TSIM:
# TSIM: print ======================== dnode1 start
tdLog.info('======================== dnode1 start')
# TSIM:
# TSIM: $dbPrefix = ta_ad_db
# TSIM: $tbPrefix = ta_ad_tb
tbPrefix = "ta_ad_tb"
# TSIM: $mtPrefix = ta_ad_mt
mtPrefix = "ta_ad_mt"
# TSIM: $tbNum = 10
tbNum = 10
# TSIM: $rowNum = 20
rowNum = 20
# TSIM: $totalNum = 200
totalNum = 200
# TSIM:
# TSIM: print =============== step1
tdLog.info('=============== step1')
# TSIM: $i = 0
i = 0
# TSIM: $db = $dbPrefix . $i
# TSIM:
# TSIM: sql create database $db
# TSIM: sql use $db
# TSIM:
# TSIM: print =============== step2
tdLog.info('=============== step2')
# TSIM: $i = 2
i = 2
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 int)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 int
tdLog.info('alter table %s add tag tgcol4 int' % (mt))
tdSql.execute('alter table %s add tag tgcol4 int' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4 =4
tdLog.info('alter table %s set tag tgcol4 =4' % (tb))
tdSql.execute('alter table %s set tag tgcol4 =4' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step2
tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1
# TSIM: step2:
# TSIM:
# TSIM: print =============== step3
tdLog.info('=============== step3')
# TSIM: $i = 3
i = 3
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# smallint, tgcol2 tinyint)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 tinyint
tdLog.info('alter table %s add tag tgcol4 tinyint' % (mt))
tdSql.execute('alter table %s add tag tgcol4 tinyint' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step3
tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1
# TSIM: step3:
# TSIM:
# TSIM: print =============== step4
tdLog.info('=============== step4')
# TSIM: $i = 4
i = 4
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bigint, tgcol2 float)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2.00000 then
tdLog.info('tdSql.checkData(0, 3, 2.00000)')
tdSql.checkData(0, 3, 2.00000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql describe $tb
tdLog.info('describe %s' % (tb))
tdSql.query('describe %s' % (tb))
# TSIM: if $data21 != BIGINT then
tdLog.info('tdSql.checkDataType(2, 1, "BIGINT")')
tdSql.checkDataType(2, 1, "BIGINT")
# TSIM: return -1
#TSIM: endi
# TSIM: if $data31 != FLOAT then
tdLog.info('tdSql.checkDataType(3, 1, "FLOAT")')
tdSql.checkDataType(3, 1, "FLOAT")
# TSIM: return -1
#TSIM: endi
# TSIM: if $data23 != 1 then
tdLog.info('tdSql.checkData(2, 3, 1)')
tdSql.checkData(2, 3, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data33 != 2.000000 then
tdLog.info('tdSql.checkData(3, 3, 2.000000)')
tdSql.checkData(3, 3, 2.000000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 float
tdLog.info('alter table %s add tag tgcol4 float' % (mt))
tdSql.execute('alter table %s add tag tgcol4 float' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4.00000 then
tdLog.info('tdSql.checkData(0, 3, 4.00000)')
tdSql.checkData(0, 3, 4.00000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step4
tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1
# TSIM: step4:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: $i = 5
i = 5
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# double, tgcol2 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, '2' )
tdLog.info('create table %s using %s tags( 1, "2" )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, "2" )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = '2'
tdLog.info('select * from %s where tgcol2 = "2"' % (mt))
tdSql.query('select * from %s where tgcol2 = "2"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1.000000000 then
tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
tdSql.checkData(0, 2, 1.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 smallint
tdLog.info('alter table %s add tag tgcol4 smallint' % (mt))
tdSql.execute('alter table %s add tag tgcol4 smallint' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1.000000000 then
tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
tdSql.checkData(0, 2, 1.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol3 = '1' -x step5
tdLog.info('select * from %s where tgcol3 = "1" -x step5' % (mt))
tdSql.error('select * from %s where tgcol3 = "1"' % (mt))
# TSIM: return -1
# TSIM: step5:
# TSIM:
# TSIM: print =============== step6
tdLog.info('=============== step6')
# TSIM: $i = 6
i = 6
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 int, tgcol3 tinyint)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, 3 )
tdLog.info('create table %s using %s tags( 1, 2, 3 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2, 3 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4
tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt))
tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 binary(10)
tdLog.info('alter table %s add tag tgcol5 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol5 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 binary(10)
tdLog.info('alter table %s add tag tgcol6 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol6 binary(10)' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=false
tdLog.info('alter table %s set tag tgcol4=false' % (tb))
tdSql.execute('alter table %s set tag tgcol4=false' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=5
tdLog.info('alter table %s set tag tgcol5=5' % (tb))
tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=6
tdLog.info('alter table %s set tag tgcol6=6' % (tb))
tdSql.execute('alter table %s set tag tgcol6=6' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = '5'
tdLog.info('select * from %s where tgcol5 = "5"' % (mt))
tdSql.query('select * from %s where tgcol5 = "5"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 0 then
tdLog.info('tdSql.checkData(0, 2, 0)')
tdSql.checkData(0, 2, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)')
tdSql.checkData(0, 3, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)')
tdSql.checkData(0, 4, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol6 = '6'
tdLog.info('select * from %s where tgcol6 = "6"' % (mt))
tdSql.query('select * from %s where tgcol6 = "6"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 0 then
tdLog.info('tdSql.checkData(0, 2, 0)')
tdSql.checkData(0, 2, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)')
tdSql.checkData(0, 3, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)')
tdSql.checkData(0, 4, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 1
tdLog.info('select * from %s where tgcol4 = 1' % (mt))
tdSql.query('select * from %s where tgcol4 = 1' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
#TSIM: endi
# TSIM: sql select * from $mt where tgcol3 = 1 -x step52
tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt))
tdSql.error('select * from %s where tgcol3 = 12' % (mt))
# TSIM: return -1
# TSIM: step52:
# TSIM:
# TSIM: print =============== step7
tdLog.info('=============== step7')
# TSIM: $i = 7
i = 7
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# smallint, tgcol2 tinyint, tgcol3 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, '3' )
tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol3 = '3'
tdLog.info('select * from %s where tgcol3 = "3"' % (mt))
tdSql.query('select * from %s where tgcol3 = "3"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4
tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt))
tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 bigint
tdLog.info('alter table %s add tag tgcol5 bigint' % (mt))
tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 tinyint
tdLog.info('alter table %s add tag tgcol6 tinyint' % (mt))
tdSql.execute('alter table %s add tag tgcol6 tinyint' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=5
tdLog.info('alter table %s set tag tgcol5=5' % (tb))
tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=6
tdLog.info('alter table %s set tag tgcol6=6' % (tb))
tdSql.execute('alter table %s set tag tgcol6=6' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol6 = 6
tdLog.info('select * from %s where tgcol6 = 6' % (mt))
tdSql.query('select * from %s where tgcol6 = 6' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 4 then
tdLog.info('tdSql.checkData(0, 2, 4)')
tdSql.checkData(0, 2, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)')
tdSql.checkData(0, 3, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)')
tdSql.checkData(0, 4, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step71
tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt))
tdSql.error('select * from %s where tgcol2 = 11' % (mt))
# TSIM: return -1
# TSIM: step71:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step72
tdLog.info('select * from %s where tgcol3 = 1 -x step72' % (mt))
tdSql.error('select * from %s where tgcol3 = 12' % (mt))
# TSIM: return -1
# TSIM: step72:
# TSIM:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: $i = 8
i = 8
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bigint, tgcol2 float, tgcol3 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, '3' )
tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol3 = '3'
tdLog.info('select * from %s where tgcol3 = "3"' % (mt))
tdSql.query('select * from %s where tgcol3 = "3"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2.00000 then
tdLog.info('tdSql.checkData(0, 3, 2.00000)')
tdSql.checkData(0, 3, 2.00000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4
tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt))
tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 binary(17)
tdLog.info('alter table %s add tag tgcol5 binary(17)' % (mt))
tdSql.execute('alter table %s add tag tgcol5 binary(17)' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 bool
tdLog.info('alter table %s add tag tgcol6 bool' % (mt))
tdSql.execute('alter table %s add tag tgcol6 bool' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=5
tdLog.info('alter table %s set tag tgcol5=5' % (tb))
tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=1
tdLog.info('alter table %s set tag tgcol6=1' % (tb))
tdSql.execute('alter table %s set tag tgcol6=1' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = '5'
tdLog.info('select * from %s where tgcol5 = "5"' % (mt))
tdSql.query('select * from %s where tgcol5 = "5"' % (mt))
# TSIM: print select * from $mt where tgcol5 = 5
tdLog.info('select * from $mt where tgcol5 = 5')
# TSIM: print $data01 $data02 $data03 $data04
tdLog.info('$data01 $data02 $data03 $data04')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 4 then
tdLog.info('tdSql.checkData(0, 2, 4)')
tdSql.checkData(0, 2, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)')
tdSql.checkData(0, 3, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 1 then
tdLog.info('tdSql.checkData(0, 4, 1)')
tdSql.checkData(0, 4, 1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step81
tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt))
tdSql.error('select * from %s where tgcol2 = 11' % (mt))
# TSIM: return -1
# TSIM: step81:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step82
tdLog.info('select * from %s where tgcol3 = 1 -x step82' % (mt))
tdSql.error('select * from %s where tgcol3 = 12' % (mt))
# TSIM: return -1
# TSIM: step82:
# TSIM:
# TSIM: print =============== step9
tdLog.info('=============== step9')
# TSIM: $i = 9
i = 9
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# double, tgcol2 binary(10), tgcol3 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, '3' )
tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = '2'
tdLog.info('select * from %s where tgcol2 = "2"' % (mt))
tdSql.query('select * from %s where tgcol2 = "2"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1.000000000 then
tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
tdSql.checkData(0, 2, 1.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4
tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt))
tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 bool
tdLog.info('alter table %s add tag tgcol5 bool' % (mt))
tdSql.execute('alter table %s add tag tgcol5 bool' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 float
tdLog.info('alter table %s add tag tgcol6 float' % (mt))
tdSql.execute('alter table %s add tag tgcol6 float' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=1
tdLog.info('alter table %s set tag tgcol5=1' % (tb))
tdSql.execute('alter table %s set tag tgcol5=1' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=6
tdLog.info('alter table %s set tag tgcol6=6' % (tb))
tdSql.execute('alter table %s set tag tgcol6=6' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = 1
tdLog.info('select * from %s where tgcol5 = 1' % (mt))
tdSql.query('select * from %s where tgcol5 = 1' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 4.000000000 then
tdLog.info('tdSql.checkData(0, 2, 4.000000000)')
tdSql.checkData(0, 2, 4.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 1 then
tdLog.info('tdSql.checkData(0, 3, 1)')
tdSql.checkData(0, 3, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 6.00000 then
tdLog.info('tdSql.checkData(0, 4, 6.00000)')
tdSql.checkData(0, 4, 6.00000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step91
tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt))
tdSql.error('select * from %s where tgcol3 = 11' % (mt))
# TSIM: return -1
# TSIM: step91:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step92
tdLog.info('select * from %s where tgcol2 = 1 -x step92' % (mt))
tdSql.error('select * from %s where tgcol2 = 12' % (mt))
# TSIM: return -1
# TSIM: step92:
# TSIM:
# TSIM: print =============== step10
tdLog.info('=============== step10')
# TSIM: $i = 10
i = 10
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( '1', '2', '3', '4' )
tdLog.info(
'create table %s using %s tags( "1", "2", "3", "4" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( "1", "2", "3", "4" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol4 = '4'
tdLog.info('select * from %s where tgcol4 = "4"' % (mt))
tdSql.query('select * from %s where tgcol4 = "4"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)')
tdSql.checkData(0, 5, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step103
tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step103' % (mt))
tdSql.error('alter table %s change tag tgcol1 tgcol403' % (mt))
# TSIM: return -1
# TSIM: step103:
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt drop tag tgcol4
tdLog.info('alter table %s drop tag tgcol4' % (mt))
tdSql.execute('alter table %s drop tag tgcol4' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $mt add tag tgcol4 binary(10)
tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 bool
tdLog.info('alter table %s add tag tgcol5 bool' % (mt))
tdSql.execute('alter table %s add tag tgcol5 bool' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=false
tdLog.info('alter table %s set tag tgcol5=false' % (tb))
tdSql.execute('alter table %s set tag tgcol5=false' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = '4'
tdLog.info('select * from %s where tgcol4 = "4"' % (mt))
tdSql.query('select * from %s where tgcol4 = "4"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 0 then
tdLog.info('tdSql.checkData(0, 4, 0)')
tdSql.checkData(0, 4, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)')
tdSql.checkData(0, 5, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step101
tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt))
tdSql.error('select * from %s where tgcol2 = 101' % (mt))
# TSIM: return -1
# TSIM: step101:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step102
tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt))
tdSql.error('select * from %s where tgcol3 = 102' % (mt))
# TSIM: return -1
# TSIM: step102:
# TSIM:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: $i = 11
i = 11
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5' )
tdLog.info(
'create table %s using %s tags( 1, 2, 3, 4, "5" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( 1, 2, 3, 4, "5" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4.00000 then
tdLog.info('tdSql.checkData(0, 5, 4.00000)')
tdSql.checkData(0, 5, 4.00000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 5 then
tdLog.info('tdSql.checkData(0, 6, 5)')
tdSql.checkData(0, 6, 5)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step114
tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step114' % (mt))
tdSql.error('alter table %s change tag tgcol1 tgcol414' % (mt))
# TSIM: return -1
# TSIM: step114:
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt drop tag tgcol4
tdLog.info('alter table %s drop tag tgcol4' % (mt))
tdSql.execute('alter table %s drop tag tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol5
tdLog.info('alter table %s drop tag tgcol5' % (mt))
tdSql.execute('alter table %s drop tag tgcol5' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $mt add tag tgcol4 binary(10)
tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 int
tdLog.info('alter table %s add tag tgcol5 int' % (mt))
tdSql.execute('alter table %s add tag tgcol5 int' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 binary(10)
tdLog.info('alter table %s add tag tgcol6 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol6 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol7 bigint
tdLog.info('alter table %s add tag tgcol7 bigint' % (mt))
tdSql.execute('alter table %s add tag tgcol7 bigint' % (mt))
# TSIM: sql alter table $mt add tag tgcol8 smallint
tdLog.info('alter table %s add tag tgcol8 smallint' % (mt))
tdSql.execute('alter table %s add tag tgcol8 smallint' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=5
tdLog.info('alter table %s set tag tgcol5=5' % (tb))
tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=6
tdLog.info('alter table %s set tag tgcol6=6' % (tb))
tdSql.execute('alter table %s set tag tgcol6=6' % (tb))
# TSIM: sql alter table $tb set tag tgcol7=7
tdLog.info('alter table %s set tag tgcol7=7' % (tb))
tdSql.execute('alter table %s set tag tgcol7=7' % (tb))
# TSIM: sql alter table $tb set tag tgcol8=8
tdLog.info('alter table %s set tag tgcol8=8' % (tb))
tdSql.execute('alter table %s set tag tgcol8=8' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol5 =5
tdLog.info('select * from %s where tgcol5 =5' % (mt))
tdSql.query('select * from %s where tgcol5 =5' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 5 then
tdLog.info('tdSql.checkData(0, 4, 5)')
tdSql.checkData(0, 4, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 6 then
tdLog.info('tdSql.checkData(0, 5, 6)')
tdSql.checkData(0, 5, 6)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 7 then
tdLog.info('tdSql.checkData(0, 6, 7)')
tdSql.checkData(0, 6, 7)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 8 then
tdLog.info('tdSql.checkData(0, 7, 8)')
tdSql.checkData(0, 7, 8)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step111
tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt))
tdSql.error('select * from %s where tgcol2 = 111' % (mt))
# TSIM: return -1
# TSIM: step111:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step112
tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt))
tdSql.error('select * from %s where tgcol3 = 112' % (mt))
# TSIM: return -1
# TSIM: step112:
# TSIM: sql select * from $mt where tgcol9 = 1 -x step113
tdLog.info('select * from %s where tgcol9 = 1 -x step113' % (mt))
tdSql.error('select * from %s where tgcol9 = 113' % (mt))
# TSIM: return -1
# TSIM: step113:
# TSIM:
# TSIM: print =============== step12
tdLog.info('=============== step12')
# TSIM: $i = 12
i = 12
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5
# binary(10), tgcol6 binary(20))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' )
tdLog.info(
'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3.00000 then
tdLog.info('tdSql.checkData(0, 4, 3.00000)')
tdSql.checkData(0, 4, 3.00000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4.000000000 then
tdLog.info('tdSql.checkData(0, 5, 4.000000000)')
tdSql.checkData(0, 5, 4.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 5 then
tdLog.info('tdSql.checkData(0, 6, 5)')
tdSql.checkData(0, 6, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, 6)')
tdSql.checkData(0, 7, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt drop tag tgcol4
tdLog.info('alter table %s drop tag tgcol4' % (mt))
tdSql.execute('alter table %s drop tag tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol5
tdLog.info('alter table %s drop tag tgcol5' % (mt))
tdSql.execute('alter table %s drop tag tgcol5' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $mt add tag tgcol2 binary(10)
tdLog.info('alter table %s add tag tgcol2 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol2 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol3 int
tdLog.info('alter table %s add tag tgcol3 int' % (mt))
tdSql.execute('alter table %s add tag tgcol3 int' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 binary(10)
tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 bigint
tdLog.info('alter table %s add tag tgcol5 bigint' % (mt))
tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol1=false
tdLog.info('alter table %s set tag tgcol1=false' % (tb))
tdSql.execute('alter table %s set tag tgcol1=false' % (tb))
# TSIM: sql alter table $tb set tag tgcol2=5
tdLog.info('alter table %s set tag tgcol2=5' % (tb))
tdSql.execute('alter table %s set tag tgcol2=5' % (tb))
# TSIM: sql alter table $tb set tag tgcol3=4
tdLog.info('alter table %s set tag tgcol3=4' % (tb))
tdSql.execute('alter table %s set tag tgcol3=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol4=3
tdLog.info('alter table %s set tag tgcol4=3' % (tb))
tdSql.execute('alter table %s set tag tgcol4=3' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=2
tdLog.info('alter table %s set tag tgcol5=2' % (tb))
tdSql.execute('alter table %s set tag tgcol5=2' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=1
tdLog.info('alter table %s set tag tgcol6=1' % (tb))
tdSql.execute('alter table %s set tag tgcol6=1' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = '3'
tdLog.info('select * from %s where tgcol4 = "3"' % (mt))
tdSql.query('select * from %s where tgcol4 = "3"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 0 then
tdLog.info('tdSql.checkData(0, 2, 0)')
tdSql.checkData(0, 2, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 1 then
tdLog.info('tdSql.checkData(0, 3, 1)')
tdSql.checkData(0, 3, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 5 then
tdLog.info('tdSql.checkData(0, 4, 5)')
tdSql.checkData(0, 4, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)')
tdSql.checkData(0, 5, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 3 then
tdLog.info('tdSql.checkData(0, 6, 3)')
tdSql.checkData(0, 6, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 2 then
tdLog.info('tdSql.checkData(0, 7, 2)')
tdSql.checkData(0, 7, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = '5'
tdLog.info('select * from %s where tgcol2 = "5"' % (mt))
tdSql.query('select * from %s where tgcol2 = "5"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol3 = 4
tdLog.info('select * from %s where tgcol3 = 4' % (mt))
tdSql.query('select * from %s where tgcol3 = 4' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = 2
tdLog.info('select * from %s where tgcol5 = 2' % (mt))
tdSql.query('select * from %s where tgcol5 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol6 = '1'
tdLog.info('select * from %s where tgcol6 = "1"' % (mt))
tdSql.query('select * from %s where tgcol6 = "1"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== step13
tdLog.info('=============== step13')
# TSIM: $i = 13
i = 13
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5
# double, tgcol6 binary(20))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' %
(mt))
# TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' )
tdLog.info(
'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = '1'
tdLog.info('select * from %s where tgcol1 = "1"' % (mt))
tdSql.query('select * from %s where tgcol1 = "1"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)')
tdSql.checkData(0, 5, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 5.000000000 then
tdLog.info('tdSql.checkData(0, 6, 5.000000000)')
tdSql.checkData(0, 6, 5.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, 6)')
tdSql.checkData(0, 7, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol4
tdLog.info('alter table %s drop tag tgcol4' % (mt))
tdSql.execute('alter table %s drop tag tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol6
tdLog.info('alter table %s drop tag tgcol6' % (mt))
tdSql.execute('alter table %s drop tag tgcol6' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $mt add tag tgcol2 binary(10)
tdLog.info('alter table %s add tag tgcol2 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol2 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 int
tdLog.info('alter table %s add tag tgcol4 int' % (mt))
tdSql.execute('alter table %s add tag tgcol4 int' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 bigint
tdLog.info('alter table %s add tag tgcol6 bigint' % (mt))
tdSql.execute('alter table %s add tag tgcol6 bigint' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol1=7
tdLog.info('alter table %s set tag tgcol1=7' % (tb))
tdSql.execute('alter table %s set tag tgcol1=7' % (tb))
# TSIM: sql alter table $tb set tag tgcol2=8
tdLog.info('alter table %s set tag tgcol2=8' % (tb))
tdSql.execute('alter table %s set tag tgcol2=8' % (tb))
# TSIM: sql alter table $tb set tag tgcol3=9
tdLog.info('alter table %s set tag tgcol3=9' % (tb))
tdSql.execute('alter table %s set tag tgcol3=9' % (tb))
# TSIM: sql alter table $tb set tag tgcol4=10
tdLog.info('alter table %s set tag tgcol4=10' % (tb))
tdSql.execute('alter table %s set tag tgcol4=10' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=11
tdLog.info('alter table %s set tag tgcol5=11' % (tb))
tdSql.execute('alter table %s set tag tgcol5=11' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=12
tdLog.info('alter table %s set tag tgcol6=12' % (tb))
tdSql.execute('alter table %s set tag tgcol6=12' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = '8'
tdLog.info('select * from %s where tgcol2 = "8"' % (mt))
tdSql.query('select * from %s where tgcol2 = "8"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)')
tdSql.checkData(0, 2, 7)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 9 then
tdLog.info('tdSql.checkData(0, 3, 9)')
tdSql.checkData(0, 3, 9)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 11.000000000 then
tdLog.info('tdSql.checkData(0, 4, 11.000000000)')
tdSql.checkData(0, 4, 11.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 8 then
tdLog.info('tdSql.checkData(0, 5, 8)')
tdSql.checkData(0, 5, 8)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 10 then
tdLog.info('tdSql.checkData(0, 6, 10)')
tdSql.checkData(0, 6, 10)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 12 then
tdLog.info('tdSql.checkData(0, 7, 12)')
tdSql.checkData(0, 7, 12)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== step14
tdLog.info('=============== step14')
# TSIM: $i = 14
i = 14
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 bigint)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 1 )
tdLog.info('create table %s using %s tags( 1, 1 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 1 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM:
# TSIM: sql alter table $mt add tag tgcol3 binary(10)
tdLog.info('alter table %s add tag tgcol3 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol3 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 int
tdLog.info('alter table %s add tag tgcol4 int' % (mt))
tdSql.execute('alter table %s add tag tgcol4 int' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 bigint
tdLog.info('alter table %s add tag tgcol5 bigint' % (mt))
tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 bigint
tdLog.info('alter table %s add tag tgcol6 bigint' % (mt))
tdSql.execute('alter table %s add tag tgcol6 bigint' % (mt))
# TSIM:
# TSIM: return
# TSIM: sql alter table $mt add tag tgcol7 bigint -x step141
tdLog.info('alter table %s add tag tgcol7 bigint -x step141' % (mt))
tdSql.error('alter table %s add tag tgcol7 bigint41' % (mt))
# TSIM: return -1
# TSIM: step141:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $mt drop tag tgcol6
tdLog.info('alter table %s drop tag tgcol6' % (mt))
tdSql.execute('alter table %s drop tag tgcol6' % (mt))
# TSIM: sql alter table $mt add tag tgcol7 bigint
tdLog.info('alter table %s add tag tgcol7 bigint' % (mt))
tdSql.execute('alter table %s add tag tgcol7 bigint' % (mt))
# TSIM: sql alter table $mt add tag tgcol8 bigint -x step142
tdLog.info('alter table %s add tag tgcol8 bigint -x step142' % (mt))
tdSql.error('alter table %s add tag tgcol8 bigint42' % (mt))
# TSIM: return -1
# TSIM: step142:
# TSIM:
# TSIM: print =============== clear
tdLog.info('=============== clear')
# TSIM: sql drop database $db
tdLog.info('sql drop database $db')
tdSql.execute('sql drop database $db')
# TSIM: sql show databases
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
# convert end
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def run(self):
tdSql.prepare()
# TSIM: system sh/stop_dnodes.sh
# TSIM:
# TSIM:
# TSIM: system sh/deploy.sh -n dnode1 -i 1
# TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0
# TSIM: system sh/exec.sh -n dnode1 -s start
# TSIM:
# TSIM: sleep 3000
# TSIM: sql connect
# TSIM:
# TSIM: print ======================== dnode1 start
tdLog.info('======================== dnode1 start')
# TSIM:
# TSIM: $dbPrefix = db
# TSIM: $tbPrefix = tb
tbPrefix = "tb"
# TSIM: $mtPrefix = mt
mtPrefix = "mt"
# TSIM: $tbNum = 10
tbNum = 10
# TSIM: $rowNum = 20
rowNum = 20
# TSIM: $totalNum = 200
totalNum = 200
# TSIM:
# TSIM: print =============== step1
tdLog.info('=============== step1')
# TSIM: $i = 0
i = 0
# TSIM: $db = $dbPrefix . $i
# TSIM:
# TSIM: sql create database $db
# TSIM: sql use $db
# TSIM:
# TSIM: print =============== step2
tdLog.info('=============== step2')
# TSIM: $i = 2
i = 2
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 int)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 int
tdLog.info('alter table %s add tag tgcol4 int' % (mt))
tdSql.execute('alter table %s add tag tgcol4 int' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4 =4
tdLog.info('alter table %s set tag tgcol4 =4' % (tb))
tdSql.execute('alter table %s set tag tgcol4 =4' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step2
tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1
# TSIM: step2:
# TSIM:
# TSIM: print =============== step3
tdLog.info('=============== step3')
# TSIM: $i = 3
i = 3
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# smallint, tgcol2 tinyint)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 tinyint
tdLog.info('alter table %s add tag tgcol4 tinyint' % (mt))
tdSql.execute('alter table %s add tag tgcol4 tinyint' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step3
tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1
# TSIM: step3:
# TSIM:
# TSIM: print =============== step4
tdLog.info('=============== step4')
# TSIM: $i = 4
i = 4
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bigint, tgcol2 float)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2.00000 then
tdLog.info('tdSql.checkData(0, 3, 2.00000)')
tdSql.checkData(0, 3, 2.00000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql describe $tb
tdLog.info('describe %s' % (tb))
tdSql.query('describe %s' % (tb))
# TSIM: if $data21 != BIGINT then
tdLog.info('tdSql.checkDataType(2, 1, "BIGINT")')
tdSql.checkDataType(2, 1, "BIGINT")
# TSIM: return -1
#TSIM: endi
# TSIM: if $data31 != FLOAT then
tdLog.info('tdSql.checkDataType(3, 1, "FLOAT")')
tdSql.checkDataType(3, 1, "FLOAT")
# TSIM: return -1
#TSIM: endi
# TSIM: if $data23 != 1 then
tdLog.info('tdSql.checkData(2, 3, 1)')
tdSql.checkData(2, 3, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data33 != 2.000000 then
tdLog.info('tdSql.checkData(3, 3, 2.000000)')
tdSql.checkData(3, 3, 2.000000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 float
tdLog.info('alter table %s add tag tgcol4 float' % (mt))
tdSql.execute('alter table %s add tag tgcol4 float' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4.00000 then
tdLog.info('tdSql.checkData(0, 3, 4.00000)')
tdSql.checkData(0, 3, 4.00000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step4
tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1
# TSIM: step4:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: $i = 5
i = 5
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# double, tgcol2 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, '2' )
tdLog.info('create table %s using %s tags( 1, "2" )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, "2" )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = '2'
tdLog.info('select * from %s where tgcol2 = "2"' % (mt))
tdSql.query('select * from %s where tgcol2 = "2"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1.000000000 then
tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
tdSql.checkData(0, 2, 1.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 smallint
tdLog.info('alter table %s add tag tgcol4 smallint' % (mt))
tdSql.execute('alter table %s add tag tgcol4 smallint' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1.000000000 then
tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
tdSql.checkData(0, 2, 1.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol3 = '1' -x step5
tdLog.info('select * from %s where tgcol3 = "1" -x step5' % (mt))
tdSql.error('select * from %s where tgcol3 = "1"' % (mt))
# TSIM: return -1
# TSIM: step5:
# TSIM:
# TSIM: print =============== step6
tdLog.info('=============== step6')
# TSIM: $i = 6
i = 6
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 int, tgcol3 tinyint)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, 3 )
tdLog.info('create table %s using %s tags( 1, 2, 3 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2, 3 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4
tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt))
tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 binary(10)
tdLog.info('alter table %s add tag tgcol5 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol5 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 binary(10)
tdLog.info('alter table %s add tag tgcol6 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol6 binary(10)' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=false
tdLog.info('alter table %s set tag tgcol4=false' % (tb))
tdSql.execute('alter table %s set tag tgcol4=false' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=5
tdLog.info('alter table %s set tag tgcol5=5' % (tb))
tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=6
tdLog.info('alter table %s set tag tgcol6=6' % (tb))
tdSql.execute('alter table %s set tag tgcol6=6' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = '5'
tdLog.info('select * from %s where tgcol5 = "5"' % (mt))
tdSql.query('select * from %s where tgcol5 = "5"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 0 then
tdLog.info('tdSql.checkData(0, 2, 0)')
tdSql.checkData(0, 2, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)')
tdSql.checkData(0, 3, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)')
tdSql.checkData(0, 4, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol6 = '6'
tdLog.info('select * from %s where tgcol6 = "6"' % (mt))
tdSql.query('select * from %s where tgcol6 = "6"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 0 then
tdLog.info('tdSql.checkData(0, 2, 0)')
tdSql.checkData(0, 2, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)')
tdSql.checkData(0, 3, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)')
tdSql.checkData(0, 4, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 1
tdLog.info('select * from %s where tgcol4 = 1' % (mt))
tdSql.query('select * from %s where tgcol4 = 1' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
#TSIM: endi
# TSIM: sql select * from $mt where tgcol3 = 1 -x step52
tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt))
tdSql.error('select * from %s where tgcol3 = 12' % (mt))
# TSIM: return -1
# TSIM: step52:
# TSIM:
# TSIM: print =============== step7
tdLog.info('=============== step7')
# TSIM: $i = 7
i = 7
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# smallint, tgcol2 tinyint, tgcol3 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, '3' )
tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol3 = '3'
tdLog.info('select * from %s where tgcol3 = "3"' % (mt))
tdSql.query('select * from %s where tgcol3 = "3"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4
tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt))
tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 bigint
tdLog.info('alter table %s add tag tgcol5 bigint' % (mt))
tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 tinyint
tdLog.info('alter table %s add tag tgcol6 tinyint' % (mt))
tdSql.execute('alter table %s add tag tgcol6 tinyint' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=5
tdLog.info('alter table %s set tag tgcol5=5' % (tb))
tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=6
tdLog.info('alter table %s set tag tgcol6=6' % (tb))
tdSql.execute('alter table %s set tag tgcol6=6' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol6 = 6
tdLog.info('select * from %s where tgcol6 = 6' % (mt))
tdSql.query('select * from %s where tgcol6 = 6' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 4 then
tdLog.info('tdSql.checkData(0, 2, 4)')
tdSql.checkData(0, 2, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)')
tdSql.checkData(0, 3, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)')
tdSql.checkData(0, 4, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step71
tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt))
tdSql.error('select * from %s where tgcol2 = 11' % (mt))
# TSIM: return -1
# TSIM: step71:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step72
tdLog.info('select * from %s where tgcol3 = 1 -x step72' % (mt))
tdSql.error('select * from %s where tgcol3 = 12' % (mt))
# TSIM: return -1
# TSIM: step72:
# TSIM:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: $i = 8
i = 8
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bigint, tgcol2 float, tgcol3 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, '3' )
tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol3 = '3'
tdLog.info('select * from %s where tgcol3 = "3"' % (mt))
tdSql.query('select * from %s where tgcol3 = "3"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2.00000 then
tdLog.info('tdSql.checkData(0, 3, 2.00000)')
tdSql.checkData(0, 3, 2.00000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4
tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt))
tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 binary(17)
tdLog.info('alter table %s add tag tgcol5 binary(17)' % (mt))
tdSql.execute('alter table %s add tag tgcol5 binary(17)' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 bool
tdLog.info('alter table %s add tag tgcol6 bool' % (mt))
tdSql.execute('alter table %s add tag tgcol6 bool' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=5
tdLog.info('alter table %s set tag tgcol5=5' % (tb))
tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=1
tdLog.info('alter table %s set tag tgcol6=1' % (tb))
tdSql.execute('alter table %s set tag tgcol6=1' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = '5'
tdLog.info('select * from %s where tgcol5 = "5"' % (mt))
tdSql.query('select * from %s where tgcol5 = "5"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 4 then
tdLog.info('tdSql.checkData(0, 2, 4)')
tdSql.checkData(0, 2, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)')
tdSql.checkData(0, 3, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 1 then
tdLog.info('tdSql.checkData(0, 4, 1)')
tdSql.checkData(0, 4, 1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step81
tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt))
tdSql.error('select * from %s where tgcol2 = 11' % (mt))
# TSIM: return -1
# TSIM: step81:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step82
tdLog.info('select * from %s where tgcol3 = 1 -x step82' % (mt))
tdSql.error('select * from %s where tgcol3 = 12' % (mt))
# TSIM: return -1
# TSIM: step82:
# TSIM:
# TSIM: print =============== step9
tdLog.info('=============== step9')
# TSIM: $i = 9
i = 9
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# double, tgcol2 binary(10), tgcol3 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, '3' )
tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = '2'
tdLog.info('select * from %s where tgcol2 = "2"' % (mt))
tdSql.query('select * from %s where tgcol2 = "2"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1.000000000 then
tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
tdSql.checkData(0, 2, 1.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4
tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt))
tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 bool
tdLog.info('alter table %s add tag tgcol5 bool' % (mt))
tdSql.execute('alter table %s add tag tgcol5 bool' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 float
tdLog.info('alter table %s add tag tgcol6 float' % (mt))
tdSql.execute('alter table %s add tag tgcol6 float' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=1
tdLog.info('alter table %s set tag tgcol5=1' % (tb))
tdSql.execute('alter table %s set tag tgcol5=1' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=6
tdLog.info('alter table %s set tag tgcol6=6' % (tb))
tdSql.execute('alter table %s set tag tgcol6=6' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = 1
tdLog.info('select * from %s where tgcol5 = 1' % (mt))
tdSql.query('select * from %s where tgcol5 = 1' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 4.000000000 then
tdLog.info('tdSql.checkData(0, 2, 4.000000000)')
tdSql.checkData(0, 2, 4.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 1 then
tdLog.info('tdSql.checkData(0, 3, 1)')
tdSql.checkData(0, 3, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 6.00000 then
tdLog.info('tdSql.checkData(0, 4, 6.00000)')
tdSql.checkData(0, 4, 6.00000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step91
tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt))
tdSql.error('select * from %s where tgcol3 = 11' % (mt))
# TSIM: return -1
# TSIM: step91:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step92
tdLog.info('select * from %s where tgcol2 = 1 -x step92' % (mt))
tdSql.error('select * from %s where tgcol2 = 12' % (mt))
# TSIM: return -1
# TSIM: step92:
# TSIM:
# TSIM: print =============== step10
tdLog.info('=============== step10')
# TSIM: $i = 10
i = 10
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( '1', '2', '3', '4' )
tdLog.info(
'create table %s using %s tags( "1", "2", "3", "4" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( "1", "2", "3", "4" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol4 = '4'
tdLog.info('select * from %s where tgcol4 = "4"' % (mt))
tdSql.query('select * from %s where tgcol4 = "4"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)')
tdSql.checkData(0, 5, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step103
tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step103' % (mt))
tdSql.error('alter table %s change tag tgcol1 tgcol403' % (mt))
# TSIM: return -1
# TSIM: step103:
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt drop tag tgcol4
tdLog.info('alter table %s drop tag tgcol4' % (mt))
tdSql.execute('alter table %s drop tag tgcol4' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $mt add tag tgcol4 binary(10)
tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 bool
tdLog.info('alter table %s add tag tgcol5 bool' % (mt))
tdSql.execute('alter table %s add tag tgcol5 bool' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=false
tdLog.info('alter table %s set tag tgcol5=false' % (tb))
tdSql.execute('alter table %s set tag tgcol5=false' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = '4'
tdLog.info('select * from %s where tgcol4 = "4"' % (mt))
tdSql.query('select * from %s where tgcol4 = "4"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 0 then
tdLog.info('tdSql.checkData(0, 4, 0)')
tdSql.checkData(0, 4, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)')
tdSql.checkData(0, 5, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step101
tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt))
tdSql.error('select * from %s where tgcol2 = 101' % (mt))
# TSIM: return -1
# TSIM: step101:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step102
tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt))
tdSql.error('select * from %s where tgcol3 = 102' % (mt))
# TSIM: return -1
# TSIM: step102:
# TSIM:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: $i = 11
i = 11
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5' )
tdLog.info(
'create table %s using %s tags( 1, 2, 3, 4, "5" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( 1, 2, 3, 4, "5" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4.00000 then
tdLog.info('tdSql.checkData(0, 5, 4.00000)')
tdSql.checkData(0, 5, 4.00000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 5 then
tdLog.info('tdSql.checkData(0, 6, 5)')
tdSql.checkData(0, 6, 5)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step114
tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step114' % (mt))
tdSql.error('alter table %s change tag tgcol1 tgcol414' % (mt))
# TSIM: return -1
# TSIM: step114:
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt drop tag tgcol4
tdLog.info('alter table %s drop tag tgcol4' % (mt))
tdSql.execute('alter table %s drop tag tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol5
tdLog.info('alter table %s drop tag tgcol5' % (mt))
tdSql.execute('alter table %s drop tag tgcol5' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $mt add tag tgcol4 binary(10)
tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 int
tdLog.info('alter table %s add tag tgcol5 int' % (mt))
tdSql.execute('alter table %s add tag tgcol5 int' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 binary(10)
tdLog.info('alter table %s add tag tgcol6 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol6 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol7 bigint
tdLog.info('alter table %s add tag tgcol7 bigint' % (mt))
tdSql.execute('alter table %s add tag tgcol7 bigint' % (mt))
# TSIM: sql alter table $mt add tag tgcol8 smallint
tdLog.info('alter table %s add tag tgcol8 smallint' % (mt))
tdSql.execute('alter table %s add tag tgcol8 smallint' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=5
tdLog.info('alter table %s set tag tgcol5=5' % (tb))
tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=6
tdLog.info('alter table %s set tag tgcol6=6' % (tb))
tdSql.execute('alter table %s set tag tgcol6=6' % (tb))
# TSIM: sql alter table $tb set tag tgcol7=7
tdLog.info('alter table %s set tag tgcol7=7' % (tb))
tdSql.execute('alter table %s set tag tgcol7=7' % (tb))
# TSIM: sql alter table $tb set tag tgcol8=8
tdLog.info('alter table %s set tag tgcol8=8' % (tb))
tdSql.execute('alter table %s set tag tgcol8=8' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol5 =5
tdLog.info('select * from %s where tgcol5 =5' % (mt))
tdSql.query('select * from %s where tgcol5 =5' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 5 then
tdLog.info('tdSql.checkData(0, 4, 5)')
tdSql.checkData(0, 4, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 6 then
tdLog.info('tdSql.checkData(0, 5, 6)')
tdSql.checkData(0, 5, 6)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 7 then
tdLog.info('tdSql.checkData(0, 6, 7)')
tdSql.checkData(0, 6, 7)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 8 then
tdLog.info('tdSql.checkData(0, 7, 8)')
tdSql.checkData(0, 7, 8)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step111
tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt))
tdSql.error('select * from %s where tgcol2 = 111' % (mt))
# TSIM: return -1
# TSIM: step111:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step112
tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt))
tdSql.error('select * from %s where tgcol3 = 112' % (mt))
# TSIM: return -1
# TSIM: step112:
# TSIM: sql select * from $mt where tgcol9 = 1 -x step113
tdLog.info('select * from %s where tgcol9 = 1 -x step113' % (mt))
tdSql.error('select * from %s where tgcol9 = 113' % (mt))
# TSIM: return -1
# TSIM: step113:
# TSIM:
# TSIM: print =============== step12
tdLog.info('=============== step12')
# TSIM: $i = 12
i = 12
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5
# binary(10), tgcol6 binary(20))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' )
tdLog.info(
'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3.00000 then
tdLog.info('tdSql.checkData(0, 4, 3.00000)')
tdSql.checkData(0, 4, 3.00000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4.000000000 then
tdLog.info('tdSql.checkData(0, 5, 4.000000000)')
tdSql.checkData(0, 5, 4.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 5 then
tdLog.info('tdSql.checkData(0, 6, 5)')
tdSql.checkData(0, 6, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, 6)')
tdSql.checkData(0, 7, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt drop tag tgcol4
tdLog.info('alter table %s drop tag tgcol4' % (mt))
tdSql.execute('alter table %s drop tag tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol5
tdLog.info('alter table %s drop tag tgcol5' % (mt))
tdSql.execute('alter table %s drop tag tgcol5' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $mt add tag tgcol2 binary(10)
tdLog.info('alter table %s add tag tgcol2 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol2 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol3 int
tdLog.info('alter table %s add tag tgcol3 int' % (mt))
tdSql.execute('alter table %s add tag tgcol3 int' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 binary(10)
tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 bigint
tdLog.info('alter table %s add tag tgcol5 bigint' % (mt))
tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol1=false
tdLog.info('alter table %s set tag tgcol1=false' % (tb))
tdSql.execute('alter table %s set tag tgcol1=false' % (tb))
# TSIM: sql alter table $tb set tag tgcol2=5
tdLog.info('alter table %s set tag tgcol2=5' % (tb))
tdSql.execute('alter table %s set tag tgcol2=5' % (tb))
# TSIM: sql alter table $tb set tag tgcol3=4
tdLog.info('alter table %s set tag tgcol3=4' % (tb))
tdSql.execute('alter table %s set tag tgcol3=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol4=3
tdLog.info('alter table %s set tag tgcol4=3' % (tb))
tdSql.execute('alter table %s set tag tgcol4=3' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=2
tdLog.info('alter table %s set tag tgcol5=2' % (tb))
tdSql.execute('alter table %s set tag tgcol5=2' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=1
tdLog.info('alter table %s set tag tgcol6=1' % (tb))
tdSql.execute('alter table %s set tag tgcol6=1' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = '3'
tdLog.info('select * from %s where tgcol4 = "3"' % (mt))
tdSql.query('select * from %s where tgcol4 = "3"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 0 then
tdLog.info('tdSql.checkData(0, 2, 0)')
tdSql.checkData(0, 2, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 1 then
tdLog.info('tdSql.checkData(0, 3, 1)')
tdSql.checkData(0, 3, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 5 then
tdLog.info('tdSql.checkData(0, 4, 5)')
tdSql.checkData(0, 4, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)')
tdSql.checkData(0, 5, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 3 then
tdLog.info('tdSql.checkData(0, 6, 3)')
tdSql.checkData(0, 6, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 2 then
tdLog.info('tdSql.checkData(0, 7, 2)')
tdSql.checkData(0, 7, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = '5'
tdLog.info('select * from %s where tgcol2 = "5"' % (mt))
tdSql.query('select * from %s where tgcol2 = "5"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol3 = 4
tdLog.info('select * from %s where tgcol3 = 4' % (mt))
tdSql.query('select * from %s where tgcol3 = 4' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = 2
tdLog.info('select * from %s where tgcol5 = 2' % (mt))
tdSql.query('select * from %s where tgcol5 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol6 = '1'
tdLog.info('select * from %s where tgcol6 = "1"' % (mt))
tdSql.query('select * from %s where tgcol6 = "1"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== step13
tdLog.info('=============== step13')
# TSIM: $i = 13
i = 13
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5
# double, tgcol6 binary(20))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' %
(mt))
# TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' )
tdLog.info(
'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = '1'
tdLog.info('select * from %s where tgcol1 = "1"' % (mt))
tdSql.query('select * from %s where tgcol1 = "1"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)')
tdSql.checkData(0, 5, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 5.000000000 then
tdLog.info('tdSql.checkData(0, 6, 5.000000000)')
tdSql.checkData(0, 6, 5.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, 6)')
tdSql.checkData(0, 7, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol4
tdLog.info('alter table %s drop tag tgcol4' % (mt))
tdSql.execute('alter table %s drop tag tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol6
tdLog.info('alter table %s drop tag tgcol6' % (mt))
tdSql.execute('alter table %s drop tag tgcol6' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $mt add tag tgcol2 binary(10)
tdLog.info('alter table %s add tag tgcol2 binary(10)' % (mt))
tdSql.execute('alter table %s add tag tgcol2 binary(10)' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 int
tdLog.info('alter table %s add tag tgcol4 int' % (mt))
tdSql.execute('alter table %s add tag tgcol4 int' % (mt))
# TSIM: sql alter table $mt add tag tgcol6 bigint
tdLog.info('alter table %s add tag tgcol6 bigint' % (mt))
tdSql.execute('alter table %s add tag tgcol6 bigint' % (mt))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol1=7
tdLog.info('alter table %s set tag tgcol1=7' % (tb))
tdSql.execute('alter table %s set tag tgcol1=7' % (tb))
# TSIM: sql alter table $tb set tag tgcol2=8
tdLog.info('alter table %s set tag tgcol2=8' % (tb))
tdSql.execute('alter table %s set tag tgcol2=8' % (tb))
# TSIM: sql alter table $tb set tag tgcol3=9
tdLog.info('alter table %s set tag tgcol3=9' % (tb))
tdSql.execute('alter table %s set tag tgcol3=9' % (tb))
# TSIM: sql alter table $tb set tag tgcol4=10
tdLog.info('alter table %s set tag tgcol4=10' % (tb))
tdSql.execute('alter table %s set tag tgcol4=10' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=11
tdLog.info('alter table %s set tag tgcol5=11' % (tb))
tdSql.execute('alter table %s set tag tgcol5=11' % (tb))
# TSIM: sql alter table $tb set tag tgcol6=12
tdLog.info('alter table %s set tag tgcol6=12' % (tb))
tdSql.execute('alter table %s set tag tgcol6=12' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = '8'
tdLog.info('select * from %s where tgcol2 = "8"' % (mt))
tdSql.query('select * from %s where tgcol2 = "8"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)')
tdSql.checkData(0, 2, 7)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 9 then
tdLog.info('tdSql.checkData(0, 3, 9)')
tdSql.checkData(0, 3, 9)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 11.000000000 then
tdLog.info('tdSql.checkData(0, 4, 11.000000000)')
tdSql.checkData(0, 4, 11.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 8 then
tdLog.info('tdSql.checkData(0, 5, 8)')
tdSql.checkData(0, 5, 8)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 10 then
tdLog.info('tdSql.checkData(0, 6, 10)')
tdSql.checkData(0, 6, 10)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 12 then
tdLog.info('tdSql.checkData(0, 7, 12)')
tdSql.checkData(0, 7, 12)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
# TSIM: sleep 5000
# TSIM: system sh/exec.sh -n dnode1 -s start
# TSIM: sleep 3000
# TSIM:
# TSIM: print =============== step1
tdLog.info('=============== step1')
# TSIM: $i = 0
i = 0
# TSIM: $db = $dbPrefix . $i
# TSIM:
# TSIM: sql use $db
# TSIM:
# TSIM: print =============== step2
tdLog.info('=============== step2')
# TSIM: $i = 2
i = 2
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== step3
tdLog.info('=============== step3')
# TSIM: $i = 3
i = 3
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== step4
tdLog.info('=============== step4')
# TSIM: $i = 4
i = 4
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4.00000 then
tdLog.info('tdSql.checkData(0, 3, 4.00000)')
tdSql.checkData(0, 3, 4.00000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: $i = 5
i = 5
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1.000000000 then
tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
tdSql.checkData(0, 2, 1.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM:
# TSIM: print =============== step6
tdLog.info('=============== step6')
# TSIM: $i = 6
i = 6
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = '5'
tdLog.info('select * from %s where tgcol5 = "5"' % (mt))
tdSql.query('select * from %s where tgcol5 = "5"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 0 then
tdLog.info('tdSql.checkData(0, 2, 0)')
tdSql.checkData(0, 2, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)')
tdSql.checkData(0, 3, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)')
tdSql.checkData(0, 4, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol6 = '6'
tdLog.info('select * from %s where tgcol6 = "6"' % (mt))
tdSql.query('select * from %s where tgcol6 = "6"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 0 then
tdLog.info('tdSql.checkData(0, 2, 0)')
tdSql.checkData(0, 2, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)')
tdSql.checkData(0, 3, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)')
tdSql.checkData(0, 4, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 1
tdLog.info('select * from %s where tgcol4 = 1' % (mt))
tdSql.query('select * from %s where tgcol4 = 1' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== step7
tdLog.info('=============== step7')
# TSIM: $i = 7
i = 7
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol6 = 6
tdLog.info('select * from %s where tgcol6 = 6' % (mt))
tdSql.query('select * from %s where tgcol6 = 6' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 4 then
tdLog.info('tdSql.checkData(0, 2, 4)')
tdSql.checkData(0, 2, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)')
tdSql.checkData(0, 3, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 6 then
tdLog.info('tdSql.checkData(0, 4, 6)')
tdSql.checkData(0, 4, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: $i = 8
i = 8
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = '5'
tdLog.info('select * from %s where tgcol5 = "5"' % (mt))
tdSql.query('select * from %s where tgcol5 = "5"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 4 then
tdLog.info('tdSql.checkData(0, 2, 4)')
tdSql.checkData(0, 2, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 5 then
tdLog.info('tdSql.checkData(0, 3, 5)')
tdSql.checkData(0, 3, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 1 then
tdLog.info('tdSql.checkData(0, 4, 1)')
tdSql.checkData(0, 4, 1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM:
# TSIM: print =============== step9
tdLog.info('=============== step9')
# TSIM: $i = 9
i = 9
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = 1
tdLog.info('select * from %s where tgcol5 = 1' % (mt))
tdSql.query('select * from %s where tgcol5 = 1' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 4.000000000 then
tdLog.info('tdSql.checkData(0, 2, 4.000000000)')
tdSql.checkData(0, 2, 4.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 1 then
tdLog.info('tdSql.checkData(0, 3, 1)')
tdSql.checkData(0, 3, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 6.00000 then
tdLog.info('tdSql.checkData(0, 4, 6.00000)')
tdSql.checkData(0, 4, 6.00000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM:
# TSIM: print =============== step10
tdLog.info('=============== step10')
# TSIM: $i = 10
i = 10
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = '4'
tdLog.info('select * from %s where tgcol4 = "4"' % (mt))
tdSql.query('select * from %s where tgcol4 = "4"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 0 then
tdLog.info('tdSql.checkData(0, 4, 0)')
tdSql.checkData(0, 4, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)')
tdSql.checkData(0, 5, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: $i = 11
i = 11
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol5 =5
tdLog.info('select * from %s where tgcol5 =5' % (mt))
tdSql.query('select * from %s where tgcol5 =5' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 5 then
tdLog.info('tdSql.checkData(0, 4, 5)')
tdSql.checkData(0, 4, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 6 then
tdLog.info('tdSql.checkData(0, 5, 6)')
tdSql.checkData(0, 5, 6)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 7 then
tdLog.info('tdSql.checkData(0, 6, 7)')
tdSql.checkData(0, 6, 7)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 8 then
tdLog.info('tdSql.checkData(0, 7, 8)')
tdSql.checkData(0, 7, 8)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== step12
tdLog.info('=============== step12')
# TSIM: $i = 12
i = 12
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = '3'
tdLog.info('select * from %s where tgcol4 = "3"' % (mt))
tdSql.query('select * from %s where tgcol4 = "3"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 0 then
tdLog.info('tdSql.checkData(0, 2, 0)')
tdSql.checkData(0, 2, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 1 then
tdLog.info('tdSql.checkData(0, 3, 1)')
tdSql.checkData(0, 3, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 5 then
tdLog.info('tdSql.checkData(0, 4, 5)')
tdSql.checkData(0, 4, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)')
tdSql.checkData(0, 5, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 3 then
tdLog.info('tdSql.checkData(0, 6, 3)')
tdSql.checkData(0, 6, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 2 then
tdLog.info('tdSql.checkData(0, 7, 2)')
tdSql.checkData(0, 7, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = '5'
tdLog.info('select * from %s where tgcol2 = "5"' % (mt))
tdSql.query('select * from %s where tgcol2 = "5"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol3 = 4
tdLog.info('select * from %s where tgcol3 = 4' % (mt))
tdSql.query('select * from %s where tgcol3 = 4' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = 2
tdLog.info('select * from %s where tgcol5 = 2' % (mt))
tdSql.query('select * from %s where tgcol5 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol6 = '1'
tdLog.info('select * from %s where tgcol6 = "1"' % (mt))
tdSql.query('select * from %s where tgcol6 = "1"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== step13
tdLog.info('=============== step13')
# TSIM: $i = 13
i = 13
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = '8'
tdLog.info('select * from %s where tgcol2 = "8"' % (mt))
tdSql.query('select * from %s where tgcol2 = "8"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)')
tdSql.checkData(0, 2, 7)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 9 then
tdLog.info('tdSql.checkData(0, 3, 9)')
tdSql.checkData(0, 3, 9)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 11.000000000 then
tdLog.info('tdSql.checkData(0, 4, 11.000000000)')
tdSql.checkData(0, 4, 11.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 8 then
tdLog.info('tdSql.checkData(0, 5, 8)')
tdSql.checkData(0, 5, 8)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 10 then
tdLog.info('tdSql.checkData(0, 6, 10)')
tdSql.checkData(0, 6, 10)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 12 then
tdLog.info('tdSql.checkData(0, 7, 12)')
tdSql.checkData(0, 7, 12)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== clear
tdLog.info('=============== clear')
# TSIM: sql drop database $db
tdLog.info('sql drop database $db')
tdSql.execute('sql drop database $db')
# TSIM: sql show databases
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
# convert end
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def run(self):
tdSql.prepare()
# TSIM: system sh/stop_dnodes.sh
# TSIM:
# TSIM:
# TSIM: system sh/deploy.sh -n dnode1 -i 1
# TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0
# TSIM: system sh/exec.sh -n dnode1 -s start
# TSIM:
# TSIM: sleep 3000
# TSIM: sql connect
# TSIM:
# TSIM: print ======================== dnode1 start
tdLog.info('======================== dnode1 start')
# TSIM:
# TSIM: $dbPrefix = ta_de_db
# TSIM: $tbPrefix = ta_de_tb
tbPrefix = "ta_de_tb"
# TSIM: $mtPrefix = ta_de_mt
mtPrefix = "ta_de_mt"
# TSIM: $tbNum = 10
tbNum = 10
# TSIM: $rowNum = 20
rowNum = 20
# TSIM: $totalNum = 200
totalNum = 200
# TSIM:
# TSIM: print =============== step1
tdLog.info('=============== step1')
# TSIM: $i = 0
i = 0
# TSIM: $db = $dbPrefix . $i
# TSIM:
# TSIM: sql create database $db
# TSIM: sql use $db
# TSIM:
# TSIM: print =============== step2
tdLog.info('=============== step2')
# TSIM: $i = 2
i = 2
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 int)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM:
# TSIM: print =============== step3
tdLog.info('=============== step3')
# TSIM: $i = 3
i = 3
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# smallint, tgcol2 tinyint)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM:
# TSIM: print =============== step4
tdLog.info('=============== step4')
# TSIM: $i = 4
i = 4
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bigint, tgcol2 float)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 < 3
tdLog.info('select * from %s where tgcol2 < 3' % (mt))
tdSql.query('select * from %s where tgcol2 < 3' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2.00000 then
tdLog.info('tdSql.checkData(0, 3, 2.00000)')
tdSql.checkData(0, 3, 2.00000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql describe $tb
tdLog.info('describe %s' % (tb))
tdSql.query('describe %s' % (tb))
# TSIM: if $data21 != BIGINT then
tdLog.info('tdSql.checkDataType(2, 1, "BIGINT")')
tdSql.checkDataType(2, 1, "BIGINT")
# TSIM: return -1
#TSIM: endi
# TSIM: if $data31 != FLOAT then
tdLog.info('tdSql.checkDataType(3, 1, "FLOAT")')
tdSql.checkDataType(3, 1, "FLOAT")
# TSIM: return -1
#TSIM: endi
# TSIM: if $data23 != 1 then
tdLog.info('tdSql.checkData(2, 3, 1)')
tdSql.checkData(2, 3, 1)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol1 -x step40
tdLog.info('alter table %s drop tag tgcol1 -x step40' % (mt))
tdSql.error('alter table %s drop tag tgcol10' % (mt))
# TSIM: return -1
# TSIM: step40:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: $i = 5
i = 5
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# double, tgcol2 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, '2' )
tdLog.info('create table %s using %s tags( 1, "2" )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, "2" )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = '2'
tdLog.info('select * from %s where tgcol2 = "2"' % (mt))
tdSql.query('select * from %s where tgcol2 = "2"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1.000000000 then
tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
tdSql.checkData(0, 2, 1.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol1 -x step50
tdLog.info('alter table %s drop tag tgcol1 -x step50' % (mt))
tdSql.error('alter table %s drop tag tgcol10' % (mt))
# TSIM: return -1
# TSIM: step50:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM:
# TSIM: print =============== step6
tdLog.info('=============== step6')
# TSIM: $i = 6
i = 6
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 int, tgcol3 tinyint)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, 3 )
tdLog.info('create table %s using %s tags( 1, 2, 3 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2, 3 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM:
# TSIM: print =============== step7
tdLog.info('=============== step7')
# TSIM: $i = 7
i = 7
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# smallint, tgcol2 tinyint, tgcol3 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, '3' )
tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol3 = '3'
tdLog.info('select * from %s where tgcol3 = "3"' % (mt))
tdSql.query('select * from %s where tgcol3 = "3"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql describe $tb
tdLog.info('describe %s' % (tb))
tdSql.query('describe %s' % (tb))
# TSIM: if $data21 != SMALLINT then
tdLog.info('tdSql.checkDataType(2, 1, "SMALLINT")')
tdSql.checkDataType(2, 1, "SMALLINT")
# TSIM: return -1
#TSIM: endi
# TSIM: if $data31 != TINYINT then
tdLog.info('tdSql.checkDataType(3, 1, "TINYINT")')
tdSql.checkDataType(3, 1, "TINYINT")
# TSIM: return -1
#TSIM: endi
# TSIM: if $data41 != BINARY then
tdLog.info('tdSql.checkDataType(4, 1, "BINARY")')
tdSql.checkDataType(4, 1, "BINARY")
# TSIM: return -1
#TSIM: endi
# TSIM: if $data22 != 2 then
tdLog.info('tdSql.checkData(2, 2, 2)')
tdSql.checkData(2, 2, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data32 != 1 then
tdLog.info('tdSql.checkData(3, 2, 1)')
tdSql.checkData(3, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data42 != 10 then
tdLog.info('tdSql.checkData(4, 2, 10)')
tdSql.checkData(4, 2, 10)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data23 != 1 then
tdLog.info('tdSql.checkData(2, 3, 1)')
tdSql.checkData(2, 3, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data33 != 2 then
tdLog.info('tdSql.checkData(3, 3, 2)')
tdSql.checkData(3, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data43 != 3 then
tdLog.info('tdSql.checkData(4, 3, 3)')
tdSql.checkData(4, 3, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: $i = 8
i = 8
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bigint, tgcol2 float, tgcol3 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, '3' )
tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol3 = '3'
tdLog.info('select * from %s where tgcol3 = "3"' % (mt))
tdSql.query('select * from %s where tgcol3 = "3"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2.00000 then
tdLog.info('tdSql.checkData(0, 3, 2.00000)')
tdSql.checkData(0, 3, 2.00000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM:
# TSIM: print =============== step9
tdLog.info('=============== step9')
# TSIM: $i = 9
i = 9
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# double, tgcol2 binary(10), tgcol3 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, '2', '3' )
tdLog.info('create table %s using %s tags( 1, "2", "3" )' % (tb, mt))
tdSql.execute(
'create table %s using %s tags( 1, "2", "3" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1.000000000 then
tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
tdSql.checkData(0, 2, 1.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM:
# TSIM: print =============== step10
tdLog.info('=============== step10')
# TSIM: $i = 10
i = 10
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( '1', '2', '3', '4' )
tdLog.info(
'create table %s using %s tags( "1", "2", "3", "4" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( "1", "2", "3", "4" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol4 = '4'
tdLog.info('select * from %s where tgcol4 = "4"' % (mt))
tdSql.query('select * from %s where tgcol4 = "4"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)')
tdSql.checkData(0, 5, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol4
tdLog.info('alter table %s drop tag tgcol4' % (mt))
tdSql.execute('alter table %s drop tag tgcol4' % (mt))
# TSIM:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: $i = 11
i = 11
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5' )
tdLog.info(
'create table %s using %s tags( 1, 2, 3, 4, "5" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( 1, 2, 3, 4, "5" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4.00000 then
tdLog.info('tdSql.checkData(0, 5, 4.00000)')
tdSql.checkData(0, 5, 4.00000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 5 then
tdLog.info('tdSql.checkData(0, 6, 5)')
tdSql.checkData(0, 6, 5)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt drop tag tgcol5
tdLog.info('alter table %s drop tag tgcol5' % (mt))
tdSql.execute('alter table %s drop tag tgcol5' % (mt))
# TSIM:
# TSIM: print =============== step12
tdLog.info('=============== step12')
# TSIM: $i = 12
i = 12
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5
# binary(10), tgcol6 binary(20))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' )
tdLog.info(
'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3.00000 then
tdLog.info('tdSql.checkData(0, 4, 3.00000)')
tdSql.checkData(0, 4, 3.00000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4.000000000 then
tdLog.info('tdSql.checkData(0, 5, 4.000000000)')
tdSql.checkData(0, 5, 4.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 5 then
tdLog.info('tdSql.checkData(0, 6, 5)')
tdSql.checkData(0, 6, 5)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, 6)')
tdSql.checkData(0, 7, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt drop tag tgcol5
tdLog.info('alter table %s drop tag tgcol5' % (mt))
tdSql.execute('alter table %s drop tag tgcol5' % (mt))
# TSIM: sql alter table $mt drop tag tgcol6
tdLog.info('alter table %s drop tag tgcol6' % (mt))
tdSql.execute('alter table %s drop tag tgcol6' % (mt))
# TSIM:
# TSIM: print =============== step13
tdLog.info('=============== step13')
# TSIM: $i = 13
i = 13
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5
# double, tgcol6 binary(20))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' %
(mt))
# TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' )
tdLog.info(
'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = '1'
tdLog.info('select * from %s where tgcol1 = "1"' % (mt))
tdSql.query('select * from %s where tgcol1 = "1"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)')
tdSql.checkData(0, 5, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 5.000000000 then
tdLog.info('tdSql.checkData(0, 6, 5.000000000)')
tdSql.checkData(0, 6, 5.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, 6)')
tdSql.checkData(0, 7, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt drop tag tgcol4
tdLog.info('alter table %s drop tag tgcol4' % (mt))
tdSql.execute('alter table %s drop tag tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol6
tdLog.info('alter table %s drop tag tgcol6' % (mt))
tdSql.execute('alter table %s drop tag tgcol6' % (mt))
# TSIM:
# TSIM: sleep 5000
# TSIM:
# TSIM: print =============== step2
tdLog.info('=============== step2')
# TSIM: $i = 2
i = 2
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step2
tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1
# TSIM: step2:
# TSIM:
# TSIM: print =============== step3
tdLog.info('=============== step3')
# TSIM: $i = 3
i = 3
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step3
tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1
# TSIM: step3:
# TSIM:
# TSIM: print =============== step4
tdLog.info('=============== step4')
# TSIM: $i = 4
i = 4
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step4
tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1
# TSIM: step4:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: $i = 5
i = 5
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1.000000000 then
tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
tdSql.checkData(0, 2, 1.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = '1' -x step5
tdLog.info('select * from %s where tgcol2 = "1" -x step5' % (mt))
tdSql.error('select * from %s where tgcol2 = "1"' % (mt))
# TSIM: return -1
# TSIM: step5:
# TSIM:
# TSIM: print =============== step6
tdLog.info('=============== step6')
# TSIM: $i = 6
i = 6
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)')
tdSql.checkData(0, 4, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step51
tdLog.info('select * from %s where tgcol2 = 1 -x step51' % (mt))
tdSql.error('select * from %s where tgcol2 = 11' % (mt))
# TSIM: return -1
# TSIM: step51:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step52
tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt))
tdSql.error('select * from %s where tgcol3 = 12' % (mt))
# TSIM: return -1
# TSIM: step52:
# TSIM:
# TSIM: print =============== step7
tdLog.info('=============== step7')
# TSIM: $i = 7
i = 7
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)')
tdSql.checkData(0, 4, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step71
tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt))
tdSql.error('select * from %s where tgcol2 = 11' % (mt))
# TSIM: return -1
# TSIM: step71:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step72
tdLog.info('select * from %s where tgcol3 = 1 -x step72' % (mt))
tdSql.error('select * from %s where tgcol3 = 12' % (mt))
# TSIM: return -1
# TSIM: step72:
# TSIM:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: $i = 8
i = 8
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)')
tdSql.checkData(0, 4, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step81
tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt))
tdSql.error('select * from %s where tgcol2 = 11' % (mt))
# TSIM: return -1
# TSIM: step81:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step82
tdLog.info('select * from %s where tgcol3 = 1 -x step82' % (mt))
tdSql.error('select * from %s where tgcol3 = 12' % (mt))
# TSIM: return -1
# TSIM: step82:
# TSIM:
# TSIM: print =============== step9
tdLog.info('=============== step9')
# TSIM: $i = 9
i = 9
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1.000000000 then
tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
tdSql.checkData(0, 2, 1.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)')
tdSql.checkData(0, 4, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step91
tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt))
tdSql.error('select * from %s where tgcol3 = 11' % (mt))
# TSIM: return -1
# TSIM: step91:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step92
tdLog.info('select * from %s where tgcol2 = 1 -x step92' % (mt))
tdSql.error('select * from %s where tgcol2 = 12' % (mt))
# TSIM: return -1
# TSIM: step92:
# TSIM:
# TSIM: print =============== step10
tdLog.info('=============== step10')
# TSIM: $i = 10
i = 10
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = '1'
tdLog.info('select * from %s where tgcol1 = "1"' % (mt))
tdSql.query('select * from %s where tgcol1 = "1"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != NULL then
tdLog.info('tdSql.checkData(0, 3, NULL)')
tdSql.checkData(0, 3, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)')
tdSql.checkData(0, 4, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)')
tdSql.checkData(0, 5, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step101
tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt))
tdSql.error('select * from %s where tgcol2 = 101' % (mt))
# TSIM: return -1
# TSIM: step101:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step102
tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt))
tdSql.error('select * from %s where tgcol3 = 102' % (mt))
# TSIM: return -1
# TSIM: step102:
# TSIM: sql select * from $mt where tgcol4 = 1 -x step103
tdLog.info('select * from %s where tgcol4 = 1 -x step103' % (mt))
tdSql.error('select * from %s where tgcol4 = 103' % (mt))
# TSIM: return -1
# TSIM: step103:
# TSIM:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: $i = 11
i = 11
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol4=4
tdLog.info('select * from %s where tgcol4=4' % (mt))
tdSql.query('select * from %s where tgcol4=4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4.00000 then
tdLog.info('tdSql.checkData(0, 3, 4.00000)')
tdSql.checkData(0, 3, 4.00000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)')
tdSql.checkData(0, 4, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)')
tdSql.checkData(0, 5, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != NULL then
tdLog.info('tdSql.checkData(0, 6, NULL)')
tdSql.checkData(0, 6, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step111
tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt))
tdSql.error('select * from %s where tgcol2 = 111' % (mt))
# TSIM: return -1
# TSIM: step111:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step112
tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt))
tdSql.error('select * from %s where tgcol3 = 112' % (mt))
# TSIM: return -1
# TSIM: step112:
# TSIM: sql select * from $mt where tgcol5 = 1 -x step113
tdLog.info('select * from %s where tgcol5 = 1 -x step113' % (mt))
tdSql.error('select * from %s where tgcol5 = 113' % (mt))
# TSIM: return -1
# TSIM: step113:
# TSIM:
# TSIM: print =============== step12
tdLog.info('=============== step12')
# TSIM: $i = 12
i = 12
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4.000000000 then
tdLog.info('tdSql.checkData(0, 3, 4.000000000)')
tdSql.checkData(0, 3, 4.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != NULL then
tdLog.info('tdSql.checkData(0, 4, NULL)')
tdSql.checkData(0, 4, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)')
tdSql.checkData(0, 5, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != NULL then
tdLog.info('tdSql.checkData(0, 6, NULL)')
tdSql.checkData(0, 6, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)')
tdSql.checkData(0, 7, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step120
tdLog.info('select * from %s where tgcol2 = 1 -x step120' % (mt))
tdSql.error('select * from %s where tgcol2 = 120' % (mt))
# TSIM: return -1
# TSIM: step120:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step121
tdLog.info('select * from %s where tgcol3 = 1 -x step121' % (mt))
tdSql.error('select * from %s where tgcol3 = 121' % (mt))
# TSIM: return -1
# TSIM: step121:
# TSIM: sql select * from $mt where tgcol5 = 1 -x step122
tdLog.info('select * from %s where tgcol5 = 1 -x step122' % (mt))
tdSql.error('select * from %s where tgcol5 = 122' % (mt))
# TSIM: return -1
# TSIM: step122:
# TSIM: sql select * from $mt where tgcol6 = 1 -x step123
tdLog.info('select * from %s where tgcol6 = 1 -x step123' % (mt))
tdSql.error('select * from %s where tgcol6 = 123' % (mt))
# TSIM: return -1
# TSIM: step123:
# TSIM:
# TSIM: print =============== step13
tdLog.info('=============== step13')
# TSIM: $i = 13
i = 13
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 5.000000000 then
tdLog.info('tdSql.checkData(0, 4, 5.000000000)')
tdSql.checkData(0, 4, 5.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != NULL then
tdLog.info('tdSql.checkData(0, 5, NULL)')
tdSql.checkData(0, 5, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != NULL then
tdLog.info('tdSql.checkData(0, 6, NULL)')
tdSql.checkData(0, 6, None)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)')
tdSql.checkData(0, 7, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol3 = 1 -x step130
tdLog.info('select * from %s where tgcol3 = 1 -x step130' % (mt))
tdSql.error('select * from %s where tgcol3 = 130' % (mt))
# TSIM: return -1
# TSIM: step130:
# TSIM: sql select * from $mt where tgcol4 = 1 -x step131
tdLog.info('select * from %s where tgcol4 = 1 -x step131' % (mt))
tdSql.error('select * from %s where tgcol4 = 131' % (mt))
# TSIM: return -1
# TSIM: step131:
# TSIM: sql select * from $mt where tgcol6 = 1 -x step133
tdLog.info('select * from %s where tgcol6 = 1 -x step133' % (mt))
tdSql.error('select * from %s where tgcol6 = 133' % (mt))
# TSIM: return -1
# TSIM: step133:
# TSIM:
# TSIM: print =============== step14
tdLog.info('=============== step14')
# TSIM: $i = 14
i = 14
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 bigint)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 1 )
tdLog.info('create table %s using %s tags( 1, 1 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 1 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM:
# TSIM: sql 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')
# TSIM: return -1
# TSIM: step141:
# TSIM: sql alter table $tb drop tag tag1 -x step142
tdLog.info('alter table %s drop tag tag1 -x step142' % (tb))
tdSql.error('alter table %s drop tag tag142' % (tb))
# TSIM: return -1
# TSIM: step142:
# TSIM: sql alter table $mt drop tag tag1 -x step143
tdLog.info('alter table %s drop tag tag1 -x step143' % (mt))
tdSql.error('alter table %s drop tag tag143' % (mt))
# TSIM: return -1
# TSIM: step143:
# TSIM:
# TSIM: sql alter table $mt drop tag tagcol1 -x step144
tdLog.info('alter table %s drop tag tagcol1 -x step144' % (mt))
tdSql.error('alter table %s drop tag tagcol144' % (mt))
# TSIM: return -1
# TSIM: step144:
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('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
tdLog.info('alter table %s drop tag tgcol1 -x step145' % (mt))
tdSql.error('alter table %s drop tag tgcol145' % (mt))
# TSIM: return -1
# TSIM: step145:
# TSIM:
# TSIM: print =============== clear
tdLog.info('=============== clear')
# TSIM: sql drop database $db
tdLog.info('sql drop database $db')
tdSql.execute('sql drop database $db')
# TSIM: sql show databases
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
# convert end
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def run(self):
tdSql.prepare()
# TSIM: system sh/stop_dnodes.sh
# TSIM:
# TSIM:
# TSIM: system sh/deploy.sh -n dnode1 -i 1
# TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0
# TSIM: system sh/exec.sh -n dnode1 -s start
# TSIM:
# TSIM: sleep 3000
# TSIM: sql connect
# TSIM:
# TSIM: print ======================== dnode1 start
tdLog.info('======================== dnode1 start')
# TSIM:
# TSIM: $dbPrefix = ta_se_db
# TSIM: $tbPrefix = ta_se_tb
tbPrefix = "ta_se_tb"
# TSIM: $mtPrefix = ta_se_mt
mtPrefix = "ta_se_mt"
# TSIM: $tbNum = 10
tbNum = 10
# TSIM: $rowNum = 20
rowNum = 20
# TSIM: $totalNum = 200
totalNum = 200
# TSIM:
# TSIM: print =============== step1
tdLog.info('=============== step1')
# TSIM: $i = 0
i = 0
# TSIM: $db = $dbPrefix . $i
# TSIM:
# TSIM: sql create database $db
# TSIM: sql use $db
# TSIM:
# TSIM: print =============== step2
tdLog.info('=============== step2')
# TSIM: $i = 2
i = 2
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 int)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $tb set tag tagcx 1 -x step21
tdLog.info('alter table %s set tag tagcx 1 -x step21' % (tb))
tdSql.error('alter table %s set tag tagcx 11' % (tb))
# TSIM: return -1
# TSIM: step21:
# TSIM: sql alter table $tb set tag tgcol1=false
tdLog.info('alter table %s set tag tgcol1=false' % (tb))
tdSql.execute('alter table %s set tag tgcol1=false' % (tb))
# TSIM: sql alter table $tb set tag tgcol2=4
tdLog.info('alter table %s set tag tgcol2=4' % (tb))
tdSql.execute('alter table %s set tag tgcol2=4' % (tb))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = false
tdLog.info('select * from %s where tgcol1 = false' % (mt))
tdSql.query('select * from %s where tgcol1 = false' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 0 then
tdLog.info('tdSql.checkData(0, 2, 0)')
tdSql.checkData(0, 2, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 4
tdLog.info('select * from %s where tgcol2 = 4' % (mt))
tdSql.query('select * from %s where tgcol2 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 0 then
tdLog.info('tdSql.checkData(0, 2, 0)')
tdSql.checkData(0, 2, 0)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql describe $tb
tdLog.info('describe %s' % (tb))
tdSql.query('describe %s' % (tb))
# TSIM: print $data21 $data23 $data32 $data33
tdLog.info('$data21 $data23 $data32 $data33')
# TSIM: if $data21 != BOOL then
tdLog.info('tdSql.checkDataType(2, 1, "BOOL")')
tdSql.checkDataType(2, 1, "BOOL")
# TSIM: return -1
#TSIM: endi
# TSIM: if $data31 != INT then
tdLog.info('tdSql.checkDataType(3, 1, "INT")')
tdSql.checkDataType(3, 1, "INT")
# TSIM: return -1
#TSIM: endi
# TSIM: if $data23 != false then
tdLog.info('tdSql.checkData(2, 3, false)')
tdSql.checkData(2, 3, false)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data33 != 4 then
tdLog.info('tdSql.checkData(3, 3, 4)')
tdSql.checkData(3, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== step3
tdLog.info('=============== step3')
# TSIM: $i = 3
i = 3
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# smallint, tgcol2 tinyint)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $tb set tag tgcol1=3
tdLog.info('alter table %s set tag tgcol1=3' % (tb))
tdSql.execute('alter table %s set tag tgcol1=3' % (tb))
# TSIM: sql alter table $tb set tag tgcol2=4
tdLog.info('alter table %s set tag tgcol2=4' % (tb))
tdSql.execute('alter table %s set tag tgcol2=4' % (tb))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = 3
tdLog.info('select * from %s where tgcol1 = 3' % (mt))
tdSql.query('select * from %s where tgcol1 = 3' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 3 then
tdLog.info('tdSql.checkData(0, 2, 3)')
tdSql.checkData(0, 2, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 4
tdLog.info('select * from %s where tgcol2 = 4' % (mt))
tdSql.query('select * from %s where tgcol2 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 3 then
tdLog.info('tdSql.checkData(0, 2, 3)')
tdSql.checkData(0, 2, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM:
# TSIM: print =============== step4
tdLog.info('=============== step4')
# TSIM: $i = 4
i = 4
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bigint, tgcol2 float)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = 1
tdLog.info('select * from %s where tgcol1 = 1' % (mt))
tdSql.query('select * from %s where tgcol1 = 1' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2.00000 then
tdLog.info('tdSql.checkData(0, 3, 2.00000)')
tdSql.checkData(0, 3, 2.00000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $tb set tag tgcol1=3
tdLog.info('alter table %s set tag tgcol1=3' % (tb))
tdSql.execute('alter table %s set tag tgcol1=3' % (tb))
# TSIM: sql alter table $tb set tag tgcol2=4
tdLog.info('alter table %s set tag tgcol2=4' % (tb))
tdSql.execute('alter table %s set tag tgcol2=4' % (tb))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = 3
tdLog.info('select * from %s where tgcol1 = 3' % (mt))
tdSql.query('select * from %s where tgcol1 = 3' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 3 then
tdLog.info('tdSql.checkData(0, 2, 3)')
tdSql.checkData(0, 2, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4.00000 then
tdLog.info('tdSql.checkData(0, 3, 4.00000)')
tdSql.checkData(0, 3, 4.00000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 4
tdLog.info('select * from %s where tgcol2 = 4' % (mt))
tdSql.query('select * from %s where tgcol2 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 3 then
tdLog.info('tdSql.checkData(0, 2, 3)')
tdSql.checkData(0, 2, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4.00000 then
tdLog.info('tdSql.checkData(0, 3, 4.00000)')
tdSql.checkData(0, 3, 4.00000)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: $i = 5
i = 5
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# double, tgcol2 binary(10))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, '2' )
tdLog.info('create table %s using %s tags( 1, "2" )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, "2" )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = '2'
tdLog.info('select * from %s where tgcol2 = "2"' % (mt))
tdSql.query('select * from %s where tgcol2 = "2"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1.000000000 then
tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
tdSql.checkData(0, 2, 1.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $tb set tag tgcol1=3
tdLog.info('alter table %s set tag tgcol1=3' % (tb))
tdSql.execute('alter table %s set tag tgcol1=3' % (tb))
# TSIM: sql alter table $tb set tag tgcol2='4'
tdLog.info('alter table %s set tag tgcol2="4"' % (tb))
tdSql.execute('alter table %s set tag tgcol2="4"' % (tb))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = 3
tdLog.info('select * from %s where tgcol1 = 3' % (mt))
tdSql.query('select * from %s where tgcol1 = 3' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 3.000000000 then
tdLog.info('tdSql.checkData(0, 2, 3.000000000)')
tdSql.checkData(0, 2, 3.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = '4'
tdLog.info('select * from %s where tgcol2 = "4"' % (mt))
tdSql.query('select * from %s where tgcol2 = "4"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 3.000000000 then
tdLog.info('tdSql.checkData(0, 2, 3.000000000)')
tdSql.checkData(0, 2, 3.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== step6
tdLog.info('=============== step6')
# TSIM: $i = 6
i = 6
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5
# double, tgcol6 binary(20))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' %
(mt))
# TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' )
tdLog.info(
'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = '1'
tdLog.info('select * from %s where tgcol1 = "1"' % (mt))
tdSql.query('select * from %s where tgcol1 = "1"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, 4)')
tdSql.checkData(0, 5, 4)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 5.000000000 then
tdLog.info('tdSql.checkData(0, 6, 5.000000000)')
tdSql.checkData(0, 6, 5.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, 6)')
tdSql.checkData(0, 7, 6)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $tb set tag tgcol1='7'
tdLog.info('alter table %s set tag tgcol1="7"' % (tb))
tdSql.execute('alter table %s set tag tgcol1="7"' % (tb))
# TSIM: sql alter table $tb set tag tgcol2=8
tdLog.info('alter table %s set tag tgcol2=8' % (tb))
tdSql.execute('alter table %s set tag tgcol2=8' % (tb))
# TSIM: sql alter table $tb set tag tgcol4='9'
tdLog.info('alter table %s set tag tgcol4="9"' % (tb))
tdSql.execute('alter table %s set tag tgcol4="9"' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=10
tdLog.info('alter table %s set tag tgcol5=10' % (tb))
tdSql.execute('alter table %s set tag tgcol5=10' % (tb))
# TSIM: sql alter table $tb set tag tgcol6='11'
tdLog.info('alter table %s set tag tgcol6="11"' % (tb))
tdSql.execute('alter table %s set tag tgcol6="11"' % (tb))
# TSIM:
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol1 = '7'
tdLog.info('select * from %s where tgcol1 = "7"' % (mt))
tdSql.query('select * from %s where tgcol1 = "7"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)')
tdSql.checkData(0, 2, 7)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 8 then
tdLog.info('tdSql.checkData(0, 3, 8)')
tdSql.checkData(0, 3, 8)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 9 then
tdLog.info('tdSql.checkData(0, 4, 9)')
tdSql.checkData(0, 4, 9)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 10.000000000 then
tdLog.info('tdSql.checkData(0, 5, 10.000000000)')
tdSql.checkData(0, 5, 10.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 11 then
tdLog.info('tdSql.checkData(0, 6, 11)')
tdSql.checkData(0, 6, 11)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)')
tdSql.checkData(0, 7, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 8
tdLog.info('select * from %s where tgcol2 = 8' % (mt))
tdSql.query('select * from %s where tgcol2 = 8' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)')
tdSql.checkData(0, 2, 7)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 8 then
tdLog.info('tdSql.checkData(0, 3, 8)')
tdSql.checkData(0, 3, 8)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 9 then
tdLog.info('tdSql.checkData(0, 4, 9)')
tdSql.checkData(0, 4, 9)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 10.000000000 then
tdLog.info('tdSql.checkData(0, 5, 10.000000000)')
tdSql.checkData(0, 5, 10.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 11 then
tdLog.info('tdSql.checkData(0, 6, 11)')
tdSql.checkData(0, 6, 11)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)')
tdSql.checkData(0, 7, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = '9'
tdLog.info('select * from %s where tgcol4 = "9"' % (mt))
tdSql.query('select * from %s where tgcol4 = "9"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)')
tdSql.checkData(0, 2, 7)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 8 then
tdLog.info('tdSql.checkData(0, 3, 8)')
tdSql.checkData(0, 3, 8)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 9 then
tdLog.info('tdSql.checkData(0, 4, 9)')
tdSql.checkData(0, 4, 9)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 10.000000000 then
tdLog.info('tdSql.checkData(0, 5, 10.000000000)')
tdSql.checkData(0, 5, 10.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 11 then
tdLog.info('tdSql.checkData(0, 6, 11)')
tdSql.checkData(0, 6, 11)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)')
tdSql.checkData(0, 7, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol5 = 10
tdLog.info('select * from %s where tgcol5 = 10' % (mt))
tdSql.query('select * from %s where tgcol5 = 10' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)')
tdSql.checkData(0, 2, 7)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 8 then
tdLog.info('tdSql.checkData(0, 3, 8)')
tdSql.checkData(0, 3, 8)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 9 then
tdLog.info('tdSql.checkData(0, 4, 9)')
tdSql.checkData(0, 4, 9)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 10.000000000 then
tdLog.info('tdSql.checkData(0, 5, 10.000000000)')
tdSql.checkData(0, 5, 10.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 11 then
tdLog.info('tdSql.checkData(0, 6, 11)')
tdSql.checkData(0, 6, 11)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)')
tdSql.checkData(0, 7, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol6 = '11'
tdLog.info('select * from %s where tgcol6 = "11"' % (mt))
tdSql.query('select * from %s where tgcol6 = "11"' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data02 != 7 then
tdLog.info('tdSql.checkData(0, 2, 7)')
tdSql.checkData(0, 2, 7)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data03 != 8 then
tdLog.info('tdSql.checkData(0, 3, 8)')
tdSql.checkData(0, 3, 8)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data04 != 9 then
tdLog.info('tdSql.checkData(0, 4, 9)')
tdSql.checkData(0, 4, 9)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data05 != 10.000000000 then
tdLog.info('tdSql.checkData(0, 5, 10.000000000)')
tdSql.checkData(0, 5, 10.000000000)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data06 != 11 then
tdLog.info('tdSql.checkData(0, 6, 11)')
tdSql.checkData(0, 6, 11)
# TSIM: return -1
#TSIM: endi
# TSIM: if $data07 != NULL then
tdLog.info('tdSql.checkData(0, 7, NULL)')
tdSql.checkData(0, 7, None)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: print =============== clear
tdLog.info('=============== clear')
# TSIM: sql drop database $db
tdLog.info('sql drop database $db')
tdSql.execute('sql drop database $db')
# TSIM: sql show databases
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
#TSIM: endi
# TSIM:
# TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
# convert end
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
...@@ -79,6 +79,9 @@ if __name__ == "__main__": ...@@ -79,6 +79,9 @@ if __name__ == "__main__":
time.sleep(1) time.sleep(1)
processID = subprocess.check_output(psCmd, shell=True) processID = subprocess.check_output(psCmd, shell=True)
fuserCmd = "fuser -k -n tcp 6030"
os.system(fuserCmd)
tdLog.info('stop All dnodes') tdLog.info('stop All dnodes')
sys.exit(0) sys.exit(0)
......
...@@ -23,7 +23,7 @@ class TDLog: ...@@ -23,7 +23,7 @@ class TDLog:
self.path = "" self.path = ""
def info(self, info): def info(self, info):
print("%s %s" % (datetime.datetime.now(), info)) print("%s %s\n" % (datetime.datetime.now(), info))
def sleep(self, sec): def sleep(self, sec):
print("%s sleep %d seconds" % (datetime.datetime.now(), sec)) print("%s sleep %d seconds" % (datetime.datetime.now(), sec))
......
...@@ -77,6 +77,31 @@ class TDSql: ...@@ -77,6 +77,31 @@ class TDSql:
tdLog.info("sql:%s, queryRows:%d == expect:%d" % tdLog.info("sql:%s, queryRows:%d == expect:%d" %
(self.sql, self.queryRows, expectRows)) (self.sql, self.queryRows, expectRows))
def checkDataType(self, row, col, dataType):
frame = inspect.stack()[1]
callerModule = inspect.getmodule(frame[0])
callerFilename = callerModule.__file__
if row < 0:
tdLog.exit(
"%s failed: sql:%s, row:%d is smaller than zero" %
(callerFilename, self.sql, row))
if col < 0:
tdLog.exit(
"%s failed: sql:%s, col:%d is smaller than zero" %
(callerFilename, self.sql, col))
if row > self.queryRows:
tdLog.exit(
"%s failed: sql:%s, row:%d is larger than queryRows:%d" %
(callerFilename, self.sql, row, self.queryRows))
if col > self.queryCols:
tdLog.exit(
"%s failed: sql:%s, col:%d is larger than queryCols:%d" %
(callerFilename, self.sql, col, self.queryCols))
return self.cursor.istype(col, dataType)
def checkData(self, row, col, data): def checkData(self, row, col, data):
frame = inspect.stack()[1] frame = inspect.stack()[1]
callerModule = inspect.getmodule(frame[0]) callerModule = inspect.getmodule(frame[0])
......
...@@ -123,7 +123,7 @@ sql insert into tb values(1520000025002, 25002) ...@@ -123,7 +123,7 @@ sql insert into tb values(1520000025002, 25002)
sql insert into tb values(1520000060000, 60000) sql insert into tb values(1520000060000, 60000)
sql select * from tb; sql select * from tb;
print $rows print $rows
if $rows != 24 then if $rows != 23 then
return -1 return -1
endi endi
...@@ -156,7 +156,7 @@ sql import into tb values(1523110400000, 50001) ...@@ -156,7 +156,7 @@ sql import into tb values(1523110400000, 50001)
sql import into tb values(1521382400000, 500051) sql import into tb values(1521382400000, 500051)
sql select * from tb; sql select * from tb;
print $rows print $rows
if $rows != 36 then if $rows != 35 then
return -1 return -1
endi endi
...@@ -169,7 +169,7 @@ sleep 5000 ...@@ -169,7 +169,7 @@ sleep 5000
sql use ir1db sql use ir1db
sql select * from tb; sql select * from tb;
print $rows print $rows
if $rows != 36 then if $rows != 35 then
return -1 return -1
endi endi
...@@ -178,7 +178,7 @@ print ================= step11 ...@@ -178,7 +178,7 @@ print ================= step11
#sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003) #sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003)
sql import into tb values(1515680000000, 7003) (1515852800000, 7003) (1516025600000, 7003) (1516198400000, 7003) (1516371200000, 7003) sql import into tb values(1515680000000, 7003) (1515852800000, 7003) (1516025600000, 7003) (1516198400000, 7003) (1516371200000, 7003)
sql select * from tb; sql select * from tb;
if $rows != 41 then if $rows != 40 then
return -1 return -1
endi endi
...@@ -188,7 +188,7 @@ print ================= step12 ...@@ -188,7 +188,7 @@ print ================= step12
sql import into tb values(1518358400000, 7003) (1518444800000, 7003) (1518531200000, 7003) (1518617600000, 7003) (1518704000000, 7003) (1518790400000, 7003) (1518876800000, 7003) (1518963200000, 7003) (1519049600000, 7003) sql import into tb values(1518358400000, 7003) (1518444800000, 7003) (1518531200000, 7003) (1518617600000, 7003) (1518704000000, 7003) (1518790400000, 7003) (1518876800000, 7003) (1518963200000, 7003) (1519049600000, 7003)
sql select * from tb; sql select * from tb;
print $rows print $rows
if $rows != 50 then if $rows != 49 then
return -1 return -1
endi endi
...@@ -204,7 +204,7 @@ sql import into tb values(1516716800000, 50001) ...@@ -204,7 +204,7 @@ sql import into tb values(1516716800000, 50001)
sql import into tb values(1517580800000, 50001) sql import into tb values(1517580800000, 50001)
sql select * from tb; sql select * from tb;
if $rows != 50 then if $rows != 52 then
return -1 return -1
endi endi
......
...@@ -32,7 +32,7 @@ cd ../../../debug; make ...@@ -32,7 +32,7 @@ cd ../../../debug; make
./test.sh -f general/compute/diff.sim ./test.sh -f general/compute/diff.sim
./test.sh -f general/compute/diff2.sim ./test.sh -f general/compute/diff2.sim
./test.sh -f general/compute/first.sim ./test.sh -f general/compute/first.sim
# liao ./test.sh -f general/compute/interval.sim ./test.sh -f general/compute/interval.sim
./test.sh -f general/compute/last.sim ./test.sh -f general/compute/last.sim
./test.sh -f general/compute/leastsquare.sim ./test.sh -f general/compute/leastsquare.sim
./test.sh -f general/compute/max.sim ./test.sh -f general/compute/max.sim
...@@ -53,7 +53,7 @@ cd ../../../debug; make ...@@ -53,7 +53,7 @@ cd ../../../debug; make
./test.sh -f general/db/delete_reuse1.sim ./test.sh -f general/db/delete_reuse1.sim
./test.sh -f general/db/delete_reuse2.sim ./test.sh -f general/db/delete_reuse2.sim
./test.sh -f general/db/delete_reusevnode.sim ./test.sh -f general/db/delete_reusevnode.sim
#hongze ./test.sh -f general/db/delete_reusevnode2.sim ./test.sh -f general/db/delete_reusevnode2.sim
./test.sh -f general/db/delete_writing1.sim ./test.sh -f general/db/delete_writing1.sim
./test.sh -f general/db/delete_writing2.sim ./test.sh -f general/db/delete_writing2.sim
./test.sh -f general/db/delete.sim ./test.sh -f general/db/delete.sim
...@@ -103,9 +103,9 @@ cd ../../../debug; make ...@@ -103,9 +103,9 @@ cd ../../../debug; make
#unsupport ./test.sh -f general/parser/alter_stable.sim #unsupport ./test.sh -f general/parser/alter_stable.sim
./test.sh -f general/parser/auto_create_tb.sim ./test.sh -f general/parser/auto_create_tb.sim
./test.sh -f general/parser/auto_create_tb_drop_tb.sim ./test.sh -f general/parser/auto_create_tb_drop_tb.sim
./test.sh -f general/parser/col_arithmetic_operation.sim #liao ./test.sh -f general/parser/col_arithmetic_operation.sim
./test.sh -f general/parser/columnValue.sim ./test.sh -f general/parser/columnValue.sim
./test.sh -f general/parser/commit.sim #liao ./test.sh -f general/parser/commit.sim
# ./test.sh -f general/parser/create_db.sim # ./test.sh -f general/parser/create_db.sim
# ./test.sh -f general/parser/create_mt.sim # ./test.sh -f general/parser/create_mt.sim
# ./test.sh -f general/parser/create_tb.sim # ./test.sh -f general/parser/create_tb.sim
...@@ -130,7 +130,7 @@ cd ../../../debug; make ...@@ -130,7 +130,7 @@ cd ../../../debug; make
# ./test.sh -f general/parser/limit1_tblocks100.sim # ./test.sh -f general/parser/limit1_tblocks100.sim
# ./test.sh -f general/parser/limit2.sim # ./test.sh -f general/parser/limit2.sim
# ./test.sh -f general/parser/mixed_blocks.sim # ./test.sh -f general/parser/mixed_blocks.sim
# ./test.sh -f general/parser/selectResNum.sim ./test.sh -f general/parser/selectResNum.sim
# ./test.sh -f general/parser/select_across_vnodes.sim # ./test.sh -f general/parser/select_across_vnodes.sim
# ./test.sh -f general/parser/set_tag_vals.sim # ./test.sh -f general/parser/set_tag_vals.sim
# ./test.sh -f general/parser/slimit.sim # ./test.sh -f general/parser/slimit.sim
...@@ -171,7 +171,7 @@ cd ../../../debug; make ...@@ -171,7 +171,7 @@ cd ../../../debug; make
./test.sh -f general/table/db.table.sim ./test.sh -f general/table/db.table.sim
./test.sh -f general/table/delete_reuse1.sim ./test.sh -f general/table/delete_reuse1.sim
./test.sh -f general/table/delete_reuse2.sim ./test.sh -f general/table/delete_reuse2.sim
#hongze ./test.sh -f general/table/delete_writing.sim #liao ./test.sh -f general/table/delete_writing.sim
./test.sh -f general/table/describe.sim ./test.sh -f general/table/describe.sim
./test.sh -f general/table/double.sim ./test.sh -f general/table/double.sim
./test.sh -f general/table/fill.sim ./test.sh -f general/table/fill.sim
...@@ -253,12 +253,12 @@ cd ../../../debug; make ...@@ -253,12 +253,12 @@ cd ../../../debug; make
./test.sh -u -f unique/column/replica3.sim ./test.sh -u -f unique/column/replica3.sim
#liao wait ./test.sh -u -f unique/db/commit.sim ./test.sh -u -f unique/db/commit.sim
./test.sh -u -f unique/db/delete.sim ./test.sh -u -f unique/db/delete.sim
./test.sh -u -f unique/db/delete_part.sim ./test.sh -u -f unique/db/delete_part.sim
./test.sh -u -f unique/db/replica_add12.sim ./test.sh -u -f unique/db/replica_add12.sim
./test.sh -u -f unique/db/replica_add13.sim ./test.sh -u -f unique/db/replica_add13.sim
#hongze wait ./test.sh -u -f unique/db/replica_add23.sim ./test.sh -u -f unique/db/replica_add23.sim
./test.sh -u -f unique/db/replica_reduce21.sim ./test.sh -u -f unique/db/replica_reduce21.sim
./test.sh -u -f unique/db/replica_reduce32.sim ./test.sh -u -f unique/db/replica_reduce32.sim
./test.sh -u -f unique/db/replica_reduce31.sim ./test.sh -u -f unique/db/replica_reduce31.sim
...@@ -269,7 +269,7 @@ cd ../../../debug; make ...@@ -269,7 +269,7 @@ cd ../../../debug; make
./test.sh -u -f unique/dnode/balance3.sim ./test.sh -u -f unique/dnode/balance3.sim
./test.sh -u -f unique/dnode/balancex.sim ./test.sh -u -f unique/dnode/balancex.sim
./test.sh -u -f unique/dnode/offline1.sim ./test.sh -u -f unique/dnode/offline1.sim
#hongze wait ./test.sh -u -f unique/dnode/offline2.sim #jeff ./test.sh -u -f unique/dnode/offline2.sim
./test.sh -u -f unique/dnode/remove1.sim ./test.sh -u -f unique/dnode/remove1.sim
#hongze ./test.sh -u -f unique/dnode/remove2.sim #hongze ./test.sh -u -f unique/dnode/remove2.sim
./test.sh -u -f unique/dnode/vnode_clean.sim ./test.sh -u -f unique/dnode/vnode_clean.sim
......
...@@ -47,10 +47,10 @@ sql create table d2.t2 (ts timestamp, i int) ...@@ -47,10 +47,10 @@ sql create table d2.t2 (ts timestamp, i int)
sql create table d3.t3 (ts timestamp, i int) sql create table d3.t3 (ts timestamp, i int)
sql create table d4.t4 (ts timestamp, i int) sql create table d4.t4 (ts timestamp, i int)
sql insert into d1.t1 values(now, 1) sql insert into d1.t1 values(1588262400001, 1)
sql insert into d2.t2 values(now, 1) sql insert into d2.t2 values(1588262400001, 1)
sql insert into d3.t3 values(now, 1) sql insert into d3.t3 values(1588262400001, 1)
sql insert into d4.t4 values(now, 1) sql insert into d4.t4 values(1588262400001, 1)
sql select * from d1.t1 sql select * from d1.t1
if $rows != 1 then if $rows != 1 then
...@@ -111,10 +111,10 @@ if $data2_3 != 4 then ...@@ -111,10 +111,10 @@ if $data2_3 != 4 then
endi endi
print ======== step4 print ======== step4
sql insert into d1.t1 values(now, 2) sql insert into d1.t1 values(1588262400002, 2)
sql insert into d2.t2 values(now, 2) sql insert into d2.t2 values(1588262400002, 2)
sql insert into d3.t3 values(now, 2) sql insert into d3.t3 values(1588262400002, 2)
sql insert into d4.t4 values(now, 2) sql insert into d4.t4 values(1588262400002, 2)
sql select * from d1.t1 sql select * from d1.t1
if $rows != 2 then if $rows != 2 then
...@@ -143,10 +143,10 @@ print ========= step5 ...@@ -143,10 +143,10 @@ print ========= step5
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 5000 sleep 5000
sql insert into d1.t1 values(now, 3) sql insert into d1.t1 values(1588262400003, 3)
sql insert into d2.t2 values(now, 3) sql insert into d2.t2 values(1588262400003, 3)
sql insert into d3.t3 values(now, 3) sql insert into d3.t3 values(1588262400003, 3)
sql insert into d4.t4 values(now, 3) sql insert into d4.t4 values(1588262400003, 3)
sql select * from d1.t1 sql select * from d1.t1
if $rows != 3 then if $rows != 3 then
...@@ -174,10 +174,10 @@ sleep 5000 ...@@ -174,10 +174,10 @@ sleep 5000
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
sleep 5000 sleep 5000
sql insert into d1.t1 values(now, 4) sql insert into d1.t1 values(1588262400004, 4)
sql insert into d2.t2 values(now, 4) sql insert into d2.t2 values(1588262400004, 4)
sql insert into d3.t3 values(now, 4) sql insert into d3.t3 values(1588262400004, 4)
sql insert into d4.t4 values(now, 4) sql insert into d4.t4 values(1588262400004, 4)
sql select * from d1.t1 sql select * from d1.t1
if $rows != 4 then if $rows != 4 then
...@@ -205,10 +205,10 @@ sleep 5000 ...@@ -205,10 +205,10 @@ sleep 5000
system sh/exec_up.sh -n dnode4 -s stop -x SIGINT system sh/exec_up.sh -n dnode4 -s stop -x SIGINT
sleep 5000 sleep 5000
sql insert into d1.t1 values(now, 5) sql insert into d1.t1 values(1588262400005, 5)
sql insert into d2.t2 values(now, 5) sql insert into d2.t2 values(1588262400005, 5)
sql insert into d3.t3 values(now, 5) sql insert into d3.t3 values(1588262400005, 5)
sql insert into d4.t4 values(now, 5) sql insert into d4.t4 values(1588262400005, 5)
sql select * from d1.t1 sql select * from d1.t1
if $rows != 5 then if $rows != 5 then
...@@ -236,10 +236,10 @@ sleep 5000 ...@@ -236,10 +236,10 @@ sleep 5000
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 5000 sleep 5000
sql insert into d1.t1 values(now, 6) sql insert into d1.t1 values(1588262400006, 6)
sql insert into d2.t2 values(now, 6) sql insert into d2.t2 values(1588262400006, 6)
sql insert into d3.t3 values(now, 6) sql insert into d3.t3 values(1588262400006, 6)
sql insert into d4.t4 values(now, 6) sql insert into d4.t4 values(1588262400006, 6)
sql select * from d1.t1 sql select * from d1.t1
if $rows != 6 then if $rows != 6 then
......
...@@ -29,7 +29,7 @@ sleep 3000 ...@@ -29,7 +29,7 @@ sleep 3000
sql create database d1 replica 2 maxTables 4 sql create database d1 replica 2 maxTables 4
sql create table d1.t1(ts timestamp, i int) sql create table d1.t1(ts timestamp, i int)
sql insert into d1.t1 values(now, 1) sql insert into d1.t1 values(1588262400001, 1)
sql show dnodes sql show dnodes
print dnode1 $data4_1 print dnode1 $data4_1
......
...@@ -22,19 +22,19 @@ sql connect ...@@ -22,19 +22,19 @@ sql connect
sql create database d1 maxTables 4 sql create database d1 maxTables 4
sql create table d1.t1 (t timestamp, i int) sql create table d1.t1 (t timestamp, i int)
sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(1588262400001, 15)
sql insert into d1.t1 values(now+2s, 14) sql insert into d1.t1 values(1588262400002, 14)
sql insert into d1.t1 values(now+3s, 13) sql insert into d1.t1 values(1588262400003, 13)
sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(1588262400004, 12)
sql insert into d1.t1 values(now+5s, 11) sql insert into d1.t1 values(1588262400005, 11)
sql create database d2 maxTables 4 sql create database d2 maxTables 4
sql create table d2.t2 (t timestamp, i int) sql create table d2.t2 (t timestamp, i int)
sql insert into d2.t2 values(now+1s, 25) sql insert into d2.t2 values(1588262400001, 25)
sql insert into d2.t2 values(now+2s, 24) sql insert into d2.t2 values(1588262400002, 24)
sql insert into d2.t2 values(now+3s, 23) sql insert into d2.t2 values(1588262400003, 23)
sql insert into d2.t2 values(now+4s, 22) sql insert into d2.t2 values(1588262400004, 22)
sql insert into d2.t2 values(now+5s, 21) sql insert into d2.t2 values(1588262400005, 21)
sql show dnodes sql show dnodes
print dnode1 openVnodes $data2_1 print dnode1 openVnodes $data2_1
...@@ -49,11 +49,11 @@ sleep 9000 ...@@ -49,11 +49,11 @@ sleep 9000
sql create database d3 replica 2 maxTables 4 sql create database d3 replica 2 maxTables 4
sql create table d3.t3 (t timestamp, i int) sql create table d3.t3 (t timestamp, i int)
sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(1588262400001, 35)
sql insert into d3.t3 values(now+2s, 34) sql insert into d3.t3 values(1588262400002, 34)
sql insert into d3.t3 values(now+3s, 33) sql insert into d3.t3 values(1588262400003, 33)
sql insert into d3.t3 values(now+4s, 32) sql insert into d3.t3 values(1588262400004, 32)
sql insert into d3.t3 values(now+5s, 31) sql insert into d3.t3 values(1588262400005, 31)
$x = 0 $x = 0
show2: show2:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册