From a1627c5d649b7397c05108cfc7db029df4839fbe Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Fri, 18 Jun 2021 16:49:39 +0800 Subject: [PATCH] support like --- src/client/src/tscSQLParser.c | 105 +- src/client/src/tscServer.c | 5 +- src/kit/shell/src/shellEngine.c | 2 +- src/query/src/qExecutor.c | 4 +- src/query/src/qFilter.c | 16 +- tests/script/general/parser/condition.sim | 1180 ++++++++++++++++++++- 6 files changed, 1184 insertions(+), 128 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 56dc921873..9a5f73f4dd 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -185,10 +185,12 @@ bool serializeExprListToVariant(SArray* pList, tVariant **dst, int16_t colType) break; } + uint32_t tType = pSub->token.type; toTSDBType(pSub->token.type); tVariant var; tVariantCreate(&var, &pSub->token); + pSub->token.type = tType; if (type == TSDB_DATA_TYPE_BOOL || type == TSDB_DATA_TYPE_TINYINT || type == TSDB_DATA_TYPE_SMALLINT || type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_INT) { tbufWriteInt64(&bw, var.i64); @@ -3465,44 +3467,28 @@ enum { TSQL_EXPR_TBNAME = 8, }; -static int32_t extractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SColumnIndex* pIndex, tSqlExpr* pExpr, int32_t sqlOptr) { +static int32_t checkColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SColumnIndex* pIndex, tSqlExpr* pExpr, int32_t sqlOptr) { STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, pIndex->tableIndex); STableMeta* pTableMeta = pTableMetaInfo->pTableMeta; SSchema* pSchema = tscGetTableColumnSchema(pTableMeta, pIndex->columnIndex); - + int32_t ret = 0; const char* msg1 = "non binary column not support like operator"; const char* msg2 = "binary column not support this operator"; const char* msg3 = "bool column not support this operator"; SColumn* pColumn = tscColumnListInsert(pQueryInfo->colList, pIndex->columnIndex, pTableMeta->id.uid, pSchema); - SColumnFilterInfo* pColFilter = NULL; /* * in case of TK_AND filter condition, we first find the corresponding column and build the query condition together * the already existed condition. */ - if (sqlOptr == TK_AND) { - // this is a new filter condition on this column - if (pColumn->info.flist.numOfFilters == 0) { - pColFilter = addColumnFilterInfo(&pColumn->info.flist); - } else { // update the existed column filter information, find the filter info here - pColFilter = &pColumn->info.flist.filterInfo[0]; - } - - if (pColFilter == NULL) { - return TSDB_CODE_TSC_OUT_OF_MEMORY; - } - } else if (sqlOptr == TK_OR) { - // TODO fixme: failed to invalid the filter expression: "col1 = 1 OR col2 = 2" - pColFilter = addColumnFilterInfo(&pColumn->info.flist); - if (pColFilter == NULL) { - return TSDB_CODE_TSC_OUT_OF_MEMORY; - } - } else { // error; + if (sqlOptr != TK_AND && sqlOptr != TK_OR) { return TSDB_CODE_TSC_INVALID_OPERATION; } + SColumnFilterInfo* pColFilter = calloc(1, sizeof(SColumnFilterInfo)); + pColFilter->filterstr = ((pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) ? 1 : 0); @@ -3513,17 +3499,20 @@ static int32_t extractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SC && pExpr->tokenId != TK_NOTNULL && pExpr->tokenId != TK_LIKE && pExpr->tokenId != TK_IN) { - return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); + ret = invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); + goto _err_ret; } } else { if (pExpr->tokenId == TK_LIKE) { - return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); + ret = invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); + goto _err_ret; } if (pSchema->type == TSDB_DATA_TYPE_BOOL) { int32_t t = pExpr->tokenId; if (t != TK_EQ && t != TK_NE && t != TK_NOTNULL && t != TK_ISNULL && t != TK_IN) { - return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); + ret = invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); + goto _err_ret; } } } @@ -3532,7 +3521,12 @@ static int32_t extractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SC pColumn->tableUid = pTableMeta->id.uid; STableComInfo tinfo = tscGetTableInfo(pTableMeta); - return doExtractColumnFilterInfo(pCmd, pQueryInfo, tinfo.precision, pColFilter, pSchema->type, pExpr); + ret = doExtractColumnFilterInfo(pCmd, pQueryInfo, tinfo.precision, pColFilter, pSchema->type, pExpr); + +_err_ret: + freeColumnFilterInfo(pColFilter, 1); + + return ret; } static int32_t getTablenameCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pTableCond, SStringBuilder* sb) { @@ -3626,25 +3620,25 @@ static int32_t getColQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlEx } -static int32_t getColumnQueryCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pExpr, int32_t relOptr) { +static int32_t checkColumnQueryCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pExpr, int32_t relOptr) { if (pExpr == NULL) { return TSDB_CODE_SUCCESS; } if (!tSqlExprIsParentOfLeaf(pExpr)) { // internal node - int32_t ret = getColumnQueryCondInfo(pCmd, pQueryInfo, pExpr->pLeft, pExpr->tokenId); + int32_t ret = checkColumnQueryCondInfo(pCmd, pQueryInfo, pExpr->pLeft, pExpr->tokenId); if (ret != TSDB_CODE_SUCCESS) { return ret; } - return getColumnQueryCondInfo(pCmd, pQueryInfo, pExpr->pRight, pExpr->tokenId); + return checkColumnQueryCondInfo(pCmd, pQueryInfo, pExpr->pRight, pExpr->tokenId); } else { // handle leaf node SColumnIndex index = COLUMN_INDEX_INITIALIZER; if (getColumnIndexByName(pCmd, &pExpr->pLeft->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_OPERATION; } - return extractColumnFilterInfo(pCmd, pQueryInfo, &index, pExpr, relOptr); + return checkColumnFilterInfo(pCmd, pQueryInfo, &index, pExpr, relOptr); } } @@ -4050,7 +4044,7 @@ static int32_t validateNullExpr(tSqlExpr* pExpr, char* msgBuf) { // check for like expression static int32_t validateLikeExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t index, char* msgBuf) { const char* msg1 = "wildcard string should be less than 20 characters"; - const char* msg2 = "illegal column name"; + const char* msg2 = "illegal column type for like"; tSqlExpr* pLeft = pExpr->pLeft; tSqlExpr* pRight = pExpr->pRight; @@ -4433,36 +4427,9 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, return TSDB_CODE_SUCCESS; } -static bool validateFilterExpr(SQueryInfo* pQueryInfo) { - SArray* pColList = pQueryInfo->colList; - - size_t num = taosArrayGetSize(pColList); - - for (int32_t i = 0; i < num; ++i) { - SColumn* pCol = taosArrayGetP(pColList, i); - - for (int32_t j = 0; j < pCol->info.flist.numOfFilters; ++j) { - SColumnFilterInfo* pColFilter = &pCol->info.flist.filterInfo[j]; - int32_t lowerOptr = pColFilter->lowerRelOptr; - int32_t upperOptr = pColFilter->upperRelOptr; - - if ((lowerOptr == TSDB_RELATION_GREATER_EQUAL || lowerOptr == TSDB_RELATION_GREATER) && - (upperOptr == TSDB_RELATION_LESS_EQUAL || upperOptr == TSDB_RELATION_LESS)) { - continue; - } - - // there must be at least two range, not support yet. - if (lowerOptr * upperOptr != TSDB_RELATION_INVALID) { - return false; - } - } - } - - return true; -} static int32_t getTimeRangeFromExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pExpr) { - const char* msg0 = "invalid timestamp"; + const char* msg0 = "invalid timestamp or operator for timestamp"; const char* msg1 = "only one time stamp window allowed"; int32_t code = 0; @@ -4844,7 +4811,7 @@ int32_t validateWhereNode(SQueryInfo* pQueryInfo, tSqlExpr** pExpr, SSqlObj* pSq } const char* msg1 = "invalid expression"; - const char* msg2 = "invalid filter expression"; +// const char* msg2 = "invalid filter expression"; int32_t ret = TSDB_CODE_SUCCESS; @@ -4887,16 +4854,16 @@ int32_t validateWhereNode(SQueryInfo* pQueryInfo, tSqlExpr** pExpr, SSqlObj* pSq goto PARSE_WHERE_EXIT; } + // 5. other column query condition + if ((ret = checkColumnQueryCondInfo(&pSql->cmd, pQueryInfo, condExpr.pColumnCond, TK_AND)) != TSDB_CODE_SUCCESS) { + goto PARSE_WHERE_EXIT; + } + if ((ret = getColQueryCondExpr(&pSql->cmd, pQueryInfo, &condExpr.pColumnCond)) != TSDB_CODE_SUCCESS) { goto PARSE_WHERE_EXIT; } - // 5. other column query condition - if ((ret = getColumnQueryCondInfo(&pSql->cmd, pQueryInfo, condExpr.pColumnCond, TK_AND)) != TSDB_CODE_SUCCESS) { - goto PARSE_WHERE_EXIT; - } - // 6. join condition if ((ret = getJoinCondInfo(&pSql->cmd, pQueryInfo, condExpr.pJoinExpr)) != TSDB_CODE_SUCCESS) { goto PARSE_WHERE_EXIT; @@ -4911,10 +4878,10 @@ int32_t validateWhereNode(SQueryInfo* pQueryInfo, tSqlExpr** pExpr, SSqlObj* pSq goto PARSE_WHERE_EXIT; } - if (!validateFilterExpr(pQueryInfo)) { - ret = invalidOperationMsg(tscGetErrorMsgPayload(&pSql->cmd), msg2); - goto PARSE_WHERE_EXIT; - } + //if (!validateFilterExpr(pQueryInfo)) { + // ret = invalidOperationMsg(tscGetErrorMsgPayload(&pSql->cmd), msg2); + // goto PARSE_WHERE_EXIT; + //} //doAddJoinTagsColumnsIntoTagList(&pSql->cmd, pQueryInfo, &condExpr); if (condExpr.tsJoin) { @@ -4945,7 +4912,7 @@ int32_t getTimeRange(STimeWindow* win, tSqlExpr* pRight, int32_t optr, int16_t t * filter primary ts filter expression like: * where ts in ('2015-12-12 4:8:12') */ - if (pRight->tokenId == TK_SET || optr == TK_IN) { + if (pRight->tokenId == TK_SET || optr == TK_IN || optr == TK_NE) { return TSDB_CODE_TSC_INVALID_OPERATION; } diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index aca8ed3083..b4c71b11db 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -882,10 +882,11 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pQueryMsg->tableCols[i].colId = htons(pCol->colId); pQueryMsg->tableCols[i].bytes = htons(pCol->bytes); pQueryMsg->tableCols[i].type = htons(pCol->type); - pQueryMsg->tableCols[i].flist.numOfFilters = htons(pCol->flist.numOfFilters); + //pQueryMsg->tableCols[i].flist.numOfFilters = htons(pCol->flist.numOfFilters); + pQueryMsg->tableCols[i].flist.numOfFilters = 0; // append the filter information after the basic column information - serializeColFilterInfo(pCol->flist.filterInfo, pCol->flist.numOfFilters, &pMsg); + //serializeColFilterInfo(pCol->flist.filterInfo, pCol->flist.numOfFilters, &pMsg); } if (pQueryInfo->colCond && taosArrayGetSize(pQueryInfo->colCond) > 0) { diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index d5fa0a9e09..f6cb135dd1 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -248,7 +248,7 @@ int32_t shellRunCommand(TAOS* con, char* command) { if (quote == c) { quote = 0; - } else if (c == '\'' || c == '"') { + } else if (quote == 0 && (c == '\'' || c == '"')) { quote = c; } diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 4b38b8c031..a77fff3fb1 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -6445,7 +6445,7 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) { pColInfo->colId = htons(pColInfo->colId); pColInfo->type = htons(pColInfo->type); pColInfo->bytes = htons(pColInfo->bytes); - pColInfo->flist.numOfFilters = htons(pColInfo->flist.numOfFilters); + pColInfo->flist.numOfFilters = 0; if (!isValidDataType(pColInfo->type)) { qDebug("qmsg:%p, invalid data type in source column, index:%d, type:%d", pQueryMsg, col, pColInfo->type); @@ -6453,6 +6453,7 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) { goto _cleanup; } +/* int32_t numOfFilters = pColInfo->flist.numOfFilters; if (numOfFilters > 0) { pColInfo->flist.filterInfo = calloc(numOfFilters, sizeof(SColumnFilterInfo)); @@ -6466,6 +6467,7 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) { if (code != TSDB_CODE_SUCCESS) { goto _cleanup; } +*/ } if (pQueryMsg->colCondLen > 0) { diff --git a/src/query/src/qFilter.c b/src/query/src/qFilter.c index ed3a3d5057..cfd894b408 100644 --- a/src/query/src/qFilter.c +++ b/src/query/src/qFilter.c @@ -334,7 +334,7 @@ int32_t filterInitValFieldData(SFilterInfo *info) { fi->data = calloc(1, sizeof(int64_t)); } - ERR_LRET(tVariantDump(var, (char*)fi->data, type, false), "dump type[%d] failed", type); + ERR_LRET(tVariantDump(var, (char*)fi->data, type, true), "dump type[%d] failed", type); } return TSDB_CODE_SUCCESS; @@ -402,8 +402,18 @@ bool filterExecute(SFilterInfo *info, int32_t numOfRows, int8_t* p) { SFilterField *left = FILTER_GET_FIELD(info, unit->left); SFilterField *right = FILTER_GET_FIELD(info, unit->right); - ures = filterDoCompare(unit, FILTER_GET_COL_FIELD_DATA(left, i), FILTER_GET_VAL_FIELD_DATA(right)); - + if (isNull(FILTER_GET_COL_FIELD_DATA(left, i), FILTER_GET_COL_FIELD_TYPE(left))) { + ures = unit->compare.optr == TSDB_RELATION_ISNULL ? true : false; + } else { + if (unit->compare.optr == TSDB_RELATION_NOTNULL) { + ures = true; + } else if (unit->compare.optr == TSDB_RELATION_ISNULL) { + ures = false; + } else { + ures = filterDoCompare(unit, FILTER_GET_COL_FIELD_DATA(left, i), FILTER_GET_VAL_FIELD_DATA(right)); + } + } + FILTER_UNIT_SET_R(info, uidx, ures); FILTER_UNIT_SET_F(info, uidx); } diff --git a/tests/script/general/parser/condition.sim b/tests/script/general/parser/condition.sim index 9ef9da44c3..ee35ec1660 100644 --- a/tests/script/general/parser/condition.sim +++ b/tests/script/general/parser/condition.sim @@ -48,65 +48,820 @@ sql insert into tb6 values ('2021-05-05 18:19:24',61,61.0,61,61,61,61.0,true ,'6 sql insert into tb6 values ('2021-05-05 18:19:25',62,62.0,62,62,62,62.0,true ,'62','62') sql insert into tb6 values ('2021-05-05 18:19:26',63,63.0,63,63,63,63.0,false,'63','63') sql insert into tb6 values ('2021-05-05 18:19:27',64,64.0,64,64,64,64.0,false,'64','64') - +sql insert into tb6 values ('2021-05-05 18:19:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) sleep 100 print "column test" +sql select * from stb1 +if $rows != 29 then + return -1 +endi sql select * from stb1 where c1 > 0 if $rows != 28 then return -1 endi -#sql select * from stb1 where c1 > 0 and c1 > 3 -#sql select * from stb1 where c1 > 0 or c1 > 3 -#sql select * from stb1 where c1 > 0 and c1 > 3 and c1 < 2 -#sql select * from stb1 where c1 > 0 or c1 > 3 or c1 < 1 -#sql select * from stb1 where c1 > 0 and c1 > 3 or c1 < 1 -#sql select * from stb1 where c1 > 0 or c1 > 3 and c1 < 1 -#sql select * from stb1 where c1 > 0 and c1 > 3 and c1 < 1 and c1 > 4 -#sql select * from stb1 where c1 > 0 and c1 > 3 and c1 < 1 or c1 > 4 -#sql select * from stb1 where c1 > 0 and c1 > 3 or c1 < 1 and c1 > 4 -#sql select * from stb1 where c1 > 0 or c1 > 3 and c1 < 1 and c1 > 4 -#sql select * from stb1 where c1 > 0 and c1 > 3 or c1 < 1 or c1 > 4 -#sql select * from stb1 where c1 > 0 or c1 > 3 and c1 < 1 or c1 > 4 -#sql select * from stb1 where c1 > 0 or c1 > 3 or c1 < 1 and c1 > 4 -#sql select * from stb1 where c1 > 0 or c1 > 3 or c1 < 1 or c1 > 4 -# -#sql select * from stb1 where (c1 > 0 and c1 > 3) and c1 < 2 -#sql select * from stb1 where c1 > 0 and (c1 > 3 and c1 < 2) -#sql select * from stb1 where (c1 > 0 or c1 > 3) or c1 < 1 -#sql select * from stb1 where c1 > 0 or (c1 > 3 or c1 < 1) -#sql select * from stb1 where (c1 > 0 and c1 > 3) or c1 < 1 -#sql select * from stb1 where c1 > 0 and (c1 > 3 or c1 < 1) -#sql select * from stb1 where (c1 > 0 or c1 > 3) and c1 < 1 -#sql select * from stb1 where c1 > 0 or (c1 > 3 and c1 < 1) -#sql select * from stb1 where (c1 > 0 and c1 > 3) and (c1 < 1 and c1 > 4) -#sql select * from stb1 where (c1 > 0 and c1 > 3 and c1 < 1) and c1 > 4 -#sql select * from stb1 where c1 > 0 and (c1 > 3 and c1 < 1) and c1 > 4 -#sql select * from stb1 where c1 > 0 and (c1 > 3 and c1 < 1 or c1 > 4) -#sql select * from stb1 where (c1 > 0 and c1 > 3) or (c1 < 1 and c1 > 4) -#sql select * from stb1 where c1 > 0 and (c1 > 3 or c1 < 1) and c1 > 4 -#sql select * from stb1 where (c1 > 0 and c1 > 3 or c1 < 1) and c1 > 4 -#sql select * from stb1 where c1 > 0 and (c1 > 3 or c1 < 1 and c1 > 4) -#sql select * from stb1 where (c1 > 0 or c1 > 3) and (c1 < 1 and c1 > 4) -#sql select * from stb1 where c1 > 0 or (c1 > 3 and c1 < 1 and c1 > 4) -#sql select * from stb1 where (c1 > 0 or c1 > 3 and c1 < 1) and c1 > 4 -#sql select * from stb1 where c1 > 0 or (c1 > 3 and c1 < 1) and c1 > 4 -#sql select * from stb1 where (c1 > 0 and c1 > 3) or (c1 < 1 or c1 > 4) -#sql select * from stb1 where c1 > 0 and (c1 > 3 or c1 < 1 or c1 > 4) -#sql select * from stb1 where (c1 > 0 and c1 > 3 or c1 < 1) or c1 > 4 -#sql select * from stb1 where c1 > 0 and (c1 > 3 or c1 < 1) or c1 > 4 -#sql select * from stb1 where (c1 > 0 or c1 > 3) and (c1 < 1 or c1 > 4) -#sql select * from stb1 where c1 > 0 or (c1 > 3 and c1 < 1 or c1 > 4) -#sql select * from stb1 where (c1 > 0 or c1 > 3 and c1 < 1) or c1 > 4 -#sql select * from stb1 where c1 > 0 or (c1 > 3 and c1 < 1) or c1 > 4 -#sql select * from stb1 where (c1 > 0 or c1 > 3) or (c1 < 1 and c1 > 4) -#sql select * from stb1 where (c1 > 0 or c1 > 3 or c1 < 1) and c1 > 4 -#sql select * from stb1 where c1 > 0 or (c1 > 3 or c1 < 1 and c1 > 4) -#sql select * from stb1 where c1 > 0 or (c1 > 3 or c1 < 1) and c1 > 4 -#sql select * from stb1 where (c1 > 0 or c1 > 3) or (c1 < 1 or c1 > 4) -#sql select * from stb1 where c1 > 0 or (c1 > 3 or c1 < 1 or c1 > 4) -#sql select * from stb1 where (c1 > 0 or c1 > 3 or c1 < 1) or c1 > 4 -#sql select * from stb1 where c1 > 0 or (c1 > 3 or c1 < 1) or c1 > 4 + +sql_error select * from stb1 where c8 > 0 +sql_error select * from stb1 where c1 in (0,1); +sql_error select ts,c1,c7 from stb1 where c7 > false +sql_error select ts,c1,c7 from stb1 where ts != '2021-05-05 18:19:27' +sql_error select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:20.000'; +sql_error select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' and ts > '2021-05-05 18:19:20.000' and ts != '2021-05-05 18:19:22.000'; +sql_error select * from stb1 where c1 > NULL; +sql_error select * from stb1 where c1 = NULL; +sql_error select * from stb1 where c1 LIKE '%1'; + +sql select * from stb1 where c2 > 3.0 or c2 < 60; +if $rows != 28 then + return -1 +endi +sql select * from stb1 where c2 > 3.0 or c2 < 60 and c2 > 50; +if $rows != 25 then + return -1 +endi +sql select * from stb1 where (c2 > 3.0 or c2 < 60) and c2 > 50; +if $rows != 8 then + return -1 +endi + +sql select * from stb1 where (c2 > 3.0 or c2 < 60) and c2 > 50 and (c2 != 53 and c2 != 63); +if $rows != 6 then + return -1 +endi + +sql select * from stb1 where (c2 > 3.0 or c2 < 60) and c2 > 50 and (c2 != 53 or c2 != 63); +if $rows != 8 then + return -1 +endi + +sql select * from stb1 where (c3 > 3.0 or c3 < 60) and c3 > 50 and (c3 != 53 or c3 != 63); +if $rows != 8 then + return -1 +endi + +sql select * from stb1 where (c4 > 3.0 or c4 < 60) and c4 > 50 and (c4 != 53 or c4 != 63); +if $rows != 8 then + return -1 +endi + +sql select * from stb1 where (c5 > 3.0 or c5 < 60) and c5 > 50 and (c5 != 53 or c5 != 63); +if $rows != 8 then + return -1 +endi + +sql select * from stb1 where (c6 > 3.0 or c6 < 60) and c6 > 50 and (c6 != 53 or c6 != 63); +if $rows != 8 then + return -1 +endi + +sql select * from stb1 where c8 = '51'; +if $rows != 1 then + return -1 +endi +if $data00 != @21-05-05 18:19:20.000@ then + return -1 +endi + +sql select * from stb1 where c8 != '51'; +if $rows != 27 then + return -1 +endi + +sql select * from stb1 where c8 = '51' and c8 != '51'; +if $rows != 0 then + return -1 +endi + +sql select * from stb1 where c8 = '51' or c8 != '51'; +if $rows != 28 then + return -1 +endi + +sql select * from stb1 where c9 = '51'; +if $rows != 1 then + return -1 +endi +if $data00 != @21-05-05 18:19:20.000@ then + return -1 +endi + +sql select * from stb1 where c9 != '51'; +if $rows != 27 then + return -1 +endi + +sql select * from stb1 where c9 = '51' and c9 != '51'; +if $rows != 0 then + return -1 +endi + +sql select * from stb1 where c9 = '51' or c9 != '51'; +if $rows != 28 then + return -1 +endi + +sql select ts,c1,c7 from stb1 where c7 = false +if $rows != 14 then + return -1 +endi +if $data00 != @21-05-05 18:19:02.000@ then + return -1 +endi +if $data01 != 3 then + return -1 +endi +if $data02 != 0 then + return -1 +endi +if $data10 != @21-05-05 18:19:03.000@ then + return -1 +endi +if $data11 != 4 then + return -1 +endi +if $data12 != 0 then + return -1 +endi +if $data20 != @21-05-05 18:19:06.000@ then + return -1 +endi +if $data21 != 13 then + return -1 +endi +if $data22 != 0 then + return -1 +endi +if $data30 != @21-05-05 18:19:07.000@ then + return -1 +endi +if $data31 != 14 then + return -1 +endi +if $data32 != 0 then + return -1 +endi + + +sql select ts,c1,c7 from stb1 where c7 = true +if $rows != 14 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +if $data02 != 1 then + return -1 +endi +if $data10 != @21-05-05 18:19:01.000@ then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 1 then + return -1 +endi +if $data20 != @21-05-05 18:19:04.000@ then + return -1 +endi +if $data21 != 11 then + return -1 +endi +if $data22 != 1 then + return -1 +endi +if $data30 != @21-05-05 18:19:05.000@ then + return -1 +endi +if $data31 != 12 then + return -1 +endi +if $data32 != 1 then + return -1 +endi + + +sql select * from stb1 where c8 = '51' or c8 = '4' +if $rows != 2 then + return -1 +endi +if $data00 != @21-05-05 18:19:03.000@ then + return -1 +endi +if $data01 != 4 then + return -1 +endi +if $data10 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data11 != 51 then + return -1 +endi + + +sql select * from stb1 where c1 > 50 and c1 > 53 +if $rows != 5 then + return -1 +endi +sql select * from stb1 where c1 > 50 or c1 > 53 +if $rows != 8 then + return -1 +endi +sql select * from stb1 where c1 > 50 and c1 > 53 and c1 < 52 +if $rows != 0 then + return -1 +endi +sql select * from stb1 where c1 > 50 or c1 > 53 or c1 < 51 +if $rows != 28 then + return -1 +endi +sql select * from stb1 where c1 > 50 and c1 > 53 or c1 < 51 +if $rows != 25 then + return -1 +endi +sql select * from stb1 where c1 > 50 or c1 > 53 and c1 < 51 +if $rows != 8 then + return -1 +endi +sql select * from stb1 where c1 > 50 and c1 > 53 and c1 > 51 and c1 > 54 +if $rows != 4 then + return -1 +endi +sql select * from stb1 where c1 > 50 and c1 > 53 and c1 > 51 or c1 > 54 +if $rows != 5 then + return -1 +endi +sql select * from stb1 where c1 > 50 and c1 > 53 and c1 < 51 or c1 > 54 +if $rows != 4 then + return -1 +endi +sql select * from stb1 where c1 > 50 and c1 > 53 or c1 < 51 and c1 > 54 +if $rows != 5 then + return -1 +endi +sql select * from stb1 where c1 > 50 and c1 > 53 or c1 > 51 and c1 < 54 +if $rows != 7 then + return -1 +endi +sql select * from stb1 where c1 > 50 or c1 > 53 and c1 < 51 and c1 > 54 +if $rows != 8 then + return -1 +endi +sql select * from stb1 where c1 > 50 and c1 > 53 or c1 < 51 or c1 > 54 +if $rows != 25 then + return -1 +endi +sql select * from stb1 where c1 > 50 or c1 > 53 and c1 < 51 or c1 > 54 +if $rows != 8 then + return -1 +endi +sql select * from stb1 where c1 > 50 or c1 > 53 or c1 < 51 and c1 > 54 +if $rows != 8 then + return -1 +endi +sql select * from stb1 where c1 > 50 or c1 > 53 or c1 > 51 and c1 > 54 +if $rows != 8 then + return -1 +endi +sql select * from stb1 where c1 > 50 or c1 > 53 or c1 < 51 or c1 > 54 +if $rows != 28 then + return -1 +endi + +sql select * from stb1 where (c1 > 50 and c1 > 53) and c1 < 52 +if $rows != 0 then + return -1 +endi +sql select * from stb1 where c1 > 50 and (c1 > 53 and c1 < 52) +if $rows != 0 then + return -1 +endi +sql select * from stb1 where (c1 > 50 or c1 > 53) or c1 < 51 +if $rows != 28 then + return -1 +endi +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) +if $rows != 28 then + return -1 +endi +sql select * from stb1 where (c1 > 50 and c1 > 53) or c1 < 51 +if $rows != 25 then + return -1 +endi +sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51) +if $rows != 5 then + return -1 +endi +sql select * from stb1 where (c1 > 50 or c1 > 53) and c1 < 51 +if $rows != 0 then + return -1 +endi +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) +if $rows != 8 then + return -1 +endi +sql select * from stb1 where (c1 > 50 and c1 > 53) and (c1 < 51 and c1 > 54) +if $rows != 0 then + return -1 +endi +sql select * from stb1 where (c1 > 50 and c1 > 53 and c1 < 51) and c1 > 54 +if $rows != 0 then + return -1 +endi +sql select * from stb1 where c1 > 50 and (c1 > 53 and c1 < 51) and c1 > 54 +if $rows != 0 then + return -1 +endi +sql select * from stb1 where c1 > 50 and (c1 > 53 and c1 < 51 or c1 > 54) +if $rows != 4 then + return -1 +endi +sql select * from stb1 where (c1 > 50 and c1 > 53) or (c1 < 51 and c1 > 54) +if $rows != 5 then + return -1 +endi +if $data00 != @21-05-05 18:19:23.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:24.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:25.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:26.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:27.000@ then + return -1 +endi +sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51) and c1 > 54 +if $rows != 4 then + return -1 +endi +if $data00 != @21-05-05 18:19:24.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:25.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:26.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:27.000@ then + return -1 +endi +sql select * from stb1 where (c1 > 50 and c1 > 53 or c1 < 51) and c1 > 54 +if $rows != 4 then + return -1 +endi +if $data00 != @21-05-05 18:19:24.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:25.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:26.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:27.000@ then + return -1 +endi +sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51 and c1 > 54) +if $rows != 5 then + return -1 +endi +if $data00 != @21-05-05 18:19:23.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:24.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:25.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:26.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:27.000@ then + return -1 +endi +sql select * from stb1 where (c1 > 50 or c1 > 53) and (c1 < 51 and c1 > 54) +if $rows != 0 then + return -1 +endi +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51 and c1 > 54) +if $rows != 8 then + return -1 +endi +if $data00 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:21.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:22.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:23.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:24.000@ then + return -1 +endi +sql select * from stb1 where (c1 > 50 or c1 > 53 and c1 < 51) and c1 > 54 +if $rows != 4 then + return -1 +endi +if $data00 != @21-05-05 18:19:24.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:25.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:26.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:27.000@ then + return -1 +endi +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) and c1 > 54 +if $rows != 8 then + return -1 +endi +if $data00 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:21.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:22.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:23.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:24.000@ then + return -1 +endi +sql select * from stb1 where (c1 > 50 and c1 > 53) or (c1 < 51 or c1 > 54) +if $rows != 25 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:01.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:02.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:03.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:04.000@ then + return -1 +endi +sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51 or c1 > 54) +if $rows != 5 then + return -1 +endi +if $data00 != @21-05-05 18:19:23.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:24.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:25.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:26.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:27.000@ then + return -1 +endi +sql select * from stb1 where (c1 > 50 and c1 > 53 or c1 < 51) or c1 > 54 +if $rows != 25 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:01.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:02.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:03.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:04.000@ then + return -1 +endi +sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51) or c1 > 54 +if $rows != 5 then + return -1 +endi +if $data00 != @21-05-05 18:19:23.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:24.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:25.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:26.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:27.000@ then + return -1 +endi +sql select * from stb1 where (c1 > 50 or c1 > 53) and (c1 < 51 or c1 > 54) +if $rows != 4 then + return -1 +endi +if $data00 != @21-05-05 18:19:24.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:25.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:26.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:27.000@ then + return -1 +endi +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51 or c1 > 54) +if $rows != 8 then + return -1 +endi +if $data00 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:21.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:22.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:23.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:24.000@ then + return -1 +endi +sql select * from stb1 where (c1 > 50 or c1 > 53 and c1 < 51) or c1 > 54 +if $rows != 8 then + return -1 +endi +if $data00 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:21.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:22.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:23.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:24.000@ then + return -1 +endi +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) or c1 > 54 +if $rows != 8 then + return -1 +endi +if $data00 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:21.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:22.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:23.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:24.000@ then + return -1 +endi +sql select * from stb1 where (c1 > 50 or c1 > 53) or (c1 < 51 and c1 > 54) +if $rows != 8 then + return -1 +endi +if $data00 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:21.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:22.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:23.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:24.000@ then + return -1 +endi +sql select * from stb1 where (c1 > 50 or c1 > 53 or c1 < 51) and c1 > 54 +if $rows != 4 then + return -1 +endi +if $data00 != @21-05-05 18:19:24.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:25.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:26.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:27.000@ then + return -1 +endi +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51 and c1 > 54) +if $rows != 8 then + return -1 +endi +if $data00 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:21.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:22.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:23.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:24.000@ then + return -1 +endi +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) and c1 > 54 +if $rows != 8 then + return -1 +endi +if $data00 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:21.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:22.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:23.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:24.000@ then + return -1 +endi +sql select * from stb1 where c1 > 62 or (c1 > 53 or c1 < 51) and c1 > 54 +if $rows != 4 then + return -1 +endi +if $data00 != @21-05-05 18:19:24.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:25.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:26.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:27.000@ then + return -1 +endi +sql select * from stb1 where (c1 > 50 or c1 > 53) or (c1 < 51 or c1 > 54) +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:01.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:02.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:03.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:04.000@ then + return -1 +endi +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51 or c1 > 54) +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:01.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:02.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:03.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:04.000@ then + return -1 +endi +sql select * from stb1 where (c1 > 50 or c1 > 53 or c1 < 51) or c1 > 54 +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:01.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:02.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:03.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:04.000@ then + return -1 +endi +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) or c1 > 54 +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:01.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:02.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:03.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:04.000@ then + return -1 +endi +sql select ts,c1 from stb1 where (c1 > 60 or c1 < 10 or (c1 > 20 and c1 < 30)) and ts > '2021-05-05 18:19:00.000' and ts < '2021-05-05 18:19:25.000' and c1 != 21 and c1 != 22 +if $rows != 6 then + return -1 +endi +if $data00 != @21-05-05 18:19:01.000@ then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data10 != @21-05-05 18:19:02.000@ then + return -1 +endi +if $data11 != 3 then + return -1 +endi +if $data20 != @21-05-05 18:19:03.000@ then + return -1 +endi +if $data21 != 4 then + return -1 +endi +if $data30 != @21-05-05 18:19:10.000@ then + return -1 +endi +if $data31 != 23 then + return -1 +endi +if $data40 != @21-05-05 18:19:11.000@ then + return -1 +endi +if $data41 != 24 then + return -1 +endi +if $data50 != @21-05-05 18:19:24.000@ then + return -1 +endi +if $data51 != 61 then + return -1 +endi + sql select * from stb1 where (c1 > 40 or c1 < 20) and (c2 < 53 or c2 >= 63) and c3 > 1 and c3 < 5 if $rows != 3 then @@ -166,6 +921,327 @@ if $data41 != 54 then return -1 endi +sql select * from stb1 where (c3 > 52 or c3 < 10) and (c4 > 1 and c4 < 61) and (c5 = 2 or c6 = 3.0 or c6 = 4.0 or c6 = 53); +if $rows != 4 then + return -1 +endi +if $data00 != @21-05-05 18:19:01.000@ then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data10 != @21-05-05 18:19:02.000@ then + return -1 +endi +if $data11 != 3 then + return -1 +endi +if $data20 != @21-05-05 18:19:03.000@ then + return -1 +endi +if $data21 != 4 then + return -1 +endi +if $data30 != @21-05-05 18:19:22.000@ then + return -1 +endi +if $data31 != 53 then + return -1 +endi + +sql select * from stb1 where c1 is null; +if $rows != 1 then + return -1 +endi +if $data00 != @21-05-05 18:19:28.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql select * from stb1 where c2 is null; +if $rows != 1 then + return -1 +endi +if $data00 != @21-05-05 18:19:28.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql select * from stb1 where c3 is null; +if $rows != 1 then + return -1 +endi +if $data00 != @21-05-05 18:19:28.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql select * from stb1 where c4 is null; +if $rows != 1 then + return -1 +endi +if $data00 != @21-05-05 18:19:28.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql select * from stb1 where c5 is null; +if $rows != 1 then + return -1 +endi +if $data00 != @21-05-05 18:19:28.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql select * from stb1 where c6 is null; +if $rows != 1 then + return -1 +endi +if $data00 != @21-05-05 18:19:28.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql select * from stb1 where c7 is null; +if $rows != 1 then + return -1 +endi +if $data00 != @21-05-05 18:19:28.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql select * from stb1 where c8 is null; +if $rows != 1 then + return -1 +endi +if $data00 != @21-05-05 18:19:28.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql select * from stb1 where c9 is null; +if $rows != 1 then + return -1 +endi +if $data00 != @21-05-05 18:19:28.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi + +sql select * from stb1 where c1 is not null; +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +sql select * from stb1 where c2 is not null; +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +sql select * from stb1 where c3 is not null; +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +sql select * from stb1 where c4 is not null; +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +sql select * from stb1 where c5 is not null; +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +sql select * from stb1 where c6 is not null; +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +sql select * from stb1 where c7 is not null; +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +sql select * from stb1 where c8 is not null; +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +sql select * from stb1 where c9 is not null; +if $rows != 28 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +sql select * from stb1 where c1 > 63 or c1 is null; +if $rows != 2 then + return -1 +endi +if $data00 != @21-05-05 18:19:27.000@ then + return -1 +endi +if $data01 != 64 then + return -1 +endi +if $data10 != @21-05-05 18:19:28.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +sql select * from stb1 where c1 is null and c2 is null; +if $rows != 1 then + return -1 +endi +if $data00 != @21-05-05 18:19:28.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql select * from stb1 where c1 is null and c2 is null and c3 is not null; +if $rows != 0 then + return -1 +endi +sql select * from stb1 where c1 is null and c2 is null and ts > '2021-05-05 18:19:00.000' and ts < '2021-05-05 18:19:28.000'; +if $rows != 0 then + return -1 +endi +sql select * from stb1 where c1 = 3 or c1 = 5 or c1 >= 44 and c1 <= 52; +if $rows != 4 then + return -1 +endi +if $data00 != @21-05-05 18:19:02.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:19.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:21.000@ then + return -1 +endi + +sql select * from stb1 where c8 LIKE '%1'; +if $rows != 7 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:04.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:08.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:12.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:16.000@ then + return -1 +endi +if $data50 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data60 != @21-05-05 18:19:24.000@ then + return -1 +endi +sql select * from stb1 where c9 LIKE '%1'; +if $rows != 7 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:04.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:08.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:12.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:16.000@ then + return -1 +endi +if $data50 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data60 != @21-05-05 18:19:24.000@ then + return -1 +endi +sql select * from stb1 where (c8 LIKE '%1' or c9 like '_2') and (c5 > 50 or c6 > 30) and ( c8 like '3_' or c9 like '4_') and (c4 <= 31 or c4 >= 42); +if $rows != 2 then + return -1 +endi +if $data00 != @21-05-05 18:19:12.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:17.000@ then + return -1 +endi print "ts test"