提交 53e6acc8 编写于 作者: W wpan

fix bug and add cases

上级 08df84d6
......@@ -465,7 +465,7 @@ int32_t tscRebuildCreateTableStatement(void *param,char *result) {
code = tscGetTableTagValue(builder, buf);
if (code == TSDB_CODE_SUCCESS) {
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "CREATE TABLE %s USING %s TAGS %s", builder->buf, builder->sTableName, buf);
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "CREATE TABLE `%s` USING `%s` TAGS %s", builder->buf, builder->sTableName, buf);
code = tscSCreateBuildResult(builder->pParentSql, SCREATE_BUILD_TABLE, builder->buf, result);
}
free(buf);
......@@ -574,12 +574,14 @@ static int32_t tscRebuildDDLForSubTable(SSqlObj *pSql, const char *tableName, ch
}
char fullName[TSDB_TABLE_FNAME_LEN * 2] = {0};
char tblName[TSDB_TABLE_NAME_LEN + 1] = {0};
tNameGetDbName(&pTableMetaInfo->name, fullName);
extractTableName(pMeta->sTableName, param->sTableName);
snprintf(fullName + strlen(fullName), TSDB_TABLE_FNAME_LEN - strlen(fullName), ".%s", param->sTableName);
snprintf(fullName + strlen(fullName), TSDB_TABLE_FNAME_LEN - strlen(fullName), ".`%s`", param->sTableName);
strncpy(param->buf, tNameGetTableName(&pTableMetaInfo->name), TSDB_TABLE_NAME_LEN);
tableNameToStr(tblName, param->buf, '\'');
param->pParentSql = pSql;
param->pInterSql = pInterSql;
......@@ -602,7 +604,7 @@ static int32_t tscRebuildDDLForSubTable(SSqlObj *pSql, const char *tableName, ch
return code;
}
snprintf(query + strlen(query), TSDB_MAX_BINARY_LEN - strlen(query), "SELECT %s FROM %s WHERE TBNAME IN(\'%s\')", columns, fullName, param->buf);
snprintf(query + strlen(query), TSDB_MAX_BINARY_LEN - strlen(query), "SELECT %s FROM %s WHERE TBNAME IN(\'%s\')", columns, fullName, tblName);
doAsyncQuery(pSql->pTscObj, pInterSql, tscSCreateCallBack, param, query, strlen(query));
free(query);
free(columns);
......@@ -619,7 +621,7 @@ static int32_t tscRebuildDDLForNormalTable(SSqlObj *pSql, const char *tableName,
SSchema *pSchema = tscGetTableSchema(pMeta);
char *result = ddl;
sprintf(result, "create table %s (", tableName);
sprintf(result, "create table `%s` (", tableName);
for (int32_t i = 0; i < numOfRows; ++i) {
uint8_t type = pSchema[i].type;
if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) {
......@@ -646,7 +648,7 @@ static int32_t tscRebuildDDLForSuperTable(SSqlObj *pSql, const char *tableName,
int32_t totalRows = numOfRows + tscGetNumOfTags(pMeta);
SSchema *pSchema = tscGetTableSchema(pMeta);
sprintf(result, "create table %s (", tableName);
sprintf(result, "create table `%s` (", tableName);
for (int32_t i = 0; i < numOfRows; ++i) {
uint8_t type = pSchema[i].type;
if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) {
......
......@@ -570,10 +570,17 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SStrToken* pzName = taosArrayGet(pInfo->pMiscInfo->a, 0);
bool escapeEnabled = (pInfo->type == TSDB_SQL_DROP_TABLE) ? true: false;
bool dbIncluded = false;
if ((pInfo->type != TSDB_SQL_DROP_DNODE) && (tscValidateName(pzName, escapeEnabled, &dbIncluded) != TSDB_CODE_SUCCESS)) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
char buf[TSDB_TABLE_FNAME_LEN];
SStrToken sTblToken;
sTblToken.z = buf;
if (pInfo->type != TSDB_SQL_DROP_DNODE) {
if ((escapeEnabled && (validateTableName(pzName->z, pzName->n, &sTblToken, &dbIncluded) != TSDB_CODE_SUCCESS)) ||
((!escapeEnabled) && (tscValidateName(pzName, escapeEnabled, &dbIncluded) != TSDB_CODE_SUCCESS))){
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
}
}
if (pInfo->type == TSDB_SQL_DROP_DB) {
......@@ -586,7 +593,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
} else if (pInfo->type == TSDB_SQL_DROP_TABLE) {
assert(taosArrayGetSize(pInfo->pMiscInfo->a) == 1);
code = tscSetTableFullName(&pTableMetaInfo->name, pzName, pSql, dbIncluded);
code = tscSetTableFullName(&pTableMetaInfo->name, &sTblToken, pSql, dbIncluded);
if(code != TSDB_CODE_SUCCESS) {
return code;
}
......@@ -727,12 +734,16 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SStrToken* pToken = taosArrayGet(pInfo->pMiscInfo->a, 0);
bool dbIncluded = false;
char buf[TSDB_TABLE_FNAME_LEN];
SStrToken sTblToken;
sTblToken.z = buf;
if (tscValidateName(pToken, true, &dbIncluded) != TSDB_CODE_SUCCESS) {
if (validateTableName(pToken->z, pToken->n, &sTblToken, &dbIncluded) != TSDB_CODE_SUCCESS) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
// additional msg has been attached already
code = tscSetTableFullName(&pTableMetaInfo->name, pToken, pSql, dbIncluded);
code = tscSetTableFullName(&pTableMetaInfo->name, &sTblToken, pSql, dbIncluded);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
......@@ -744,13 +755,17 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const char* msg1 = "invalid table name";
SStrToken* pToken = taosArrayGet(pInfo->pMiscInfo->a, 0);
bool dbIncluded = false;
if (tscValidateName(pToken, true, &dbIncluded) != TSDB_CODE_SUCCESS) {
char buf[TSDB_TABLE_FNAME_LEN];
SStrToken sTblToken;
sTblToken.z = buf;
if (validateTableName(pToken->z, pToken->n, &sTblToken, &dbIncluded) != TSDB_CODE_SUCCESS) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
code = tscSetTableFullName(&pTableMetaInfo->name, pToken, pSql, dbIncluded);
code = tscSetTableFullName(&pTableMetaInfo->name, &sTblToken, pSql, dbIncluded);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
......@@ -3201,6 +3216,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const char* msg3 = "database name too long";
const char* msg5 = "database name is empty";
const char* msg6 = "pattern string is empty";
const char* msg7 = "pattern is invalid";
/*
* database prefix in pInfo->pMiscInfo->a[0]
......@@ -3233,6 +3249,10 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
// show table/stable like 'xxxx', set the like pattern for show tables
SStrToken* pPattern = &pShowInfo->pattern;
if (pPattern->type != 0) {
if (pPattern->type == TK_ID && pPattern->z[0] == TS_ESCAPE_CHAR) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7);
}
pPattern->n = strdequote(pPattern->z);
if (pPattern->n <= 0) {
......@@ -8443,14 +8463,18 @@ static int32_t doLoadAllTableMeta(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNod
}
tscDequoteAndTrimToken(oriName);
bool dbIncluded = false;
if (tscValidateName(oriName, true, &dbIncluded) != TSDB_CODE_SUCCESS) {
char buf[TSDB_TABLE_FNAME_LEN];
SStrToken sTblToken;
sTblToken.z = buf;
if (validateTableName(oriName->z, oriName->n, &sTblToken, &dbIncluded) != TSDB_CODE_SUCCESS) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, i);
code = tscSetTableFullName(&pTableMetaInfo->name, oriName, pSql, dbIncluded);
code = tscSetTableFullName(&pTableMetaInfo->name, &sTblToken, pSql, dbIncluded);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
......@@ -8996,6 +9020,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS
if (colSize > 0) {
SColIndex* idx = taosArrayGet(pCols, colSize - 1);
SSchema* pSchema = tscGetTableColumnSchema(pTableMeta, idx->colIndex);
// convert time by precision
if (pSchema != NULL && TSDB_DATA_TYPE_TIMESTAMP == pSchema->type && TSDB_DATA_TYPE_BINARY == (*pExpr)->pVal->nType) {
......
......@@ -2869,7 +2869,7 @@ int32_t getMultiTableMetaFromMnode(SSqlObj *pSql, SArray* pNameList, SArray* pVg
for(int32_t i = 0; i < numOfTable; ++i) {
char* name = taosArrayGetP(pNameList, i);
if (i < numOfTable - 1 || numOfVgroupList > 0 || numOfUdf > 0) {
len = sprintf(start, "%s·", name);
len = sprintf(start, "%s`", name);
} else {
len = sprintf(start, "%s", name);
}
......@@ -2880,7 +2880,7 @@ int32_t getMultiTableMetaFromMnode(SSqlObj *pSql, SArray* pNameList, SArray* pVg
for(int32_t i = 0; i < numOfVgroupList; ++i) {
char* name = taosArrayGetP(pVgroupNameList, i);
if (i < numOfVgroupList - 1 || numOfUdf > 0) {
len = sprintf(start, "%s·", name);
len = sprintf(start, "%s`", name);
} else {
len = sprintf(start, "%s", name);
}
......@@ -2891,7 +2891,7 @@ int32_t getMultiTableMetaFromMnode(SSqlObj *pSql, SArray* pNameList, SArray* pVg
for(int32_t i = 0; i < numOfUdf; ++i) {
SUdfInfo * u = taosArrayGet(pUdfList, i);
if (i < numOfUdf - 1) {
len = sprintf(start, "%s·", u->name);
len = sprintf(start, "%s`", u->name);
} else {
len = sprintf(start, "%s", u->name);
}
......
......@@ -2835,11 +2835,16 @@ void tscRmEscapeAndTrimToken(SStrToken* pToken) {
int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded) {
if (pToken == NULL || pToken->z == NULL
|| (escapeEnabled && pToken->type != TK_STRING && pToken->type != TK_ID && pToken->type != TK_ESCAPE)
|| ((!escapeEnabled) && pToken->type != TK_STRING && pToken->type != TK_ID)) {
|| (pToken->type != TK_STRING && pToken->type != TK_ID)) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
if ((!escapeEnabled) && pToken->type == TK_ID) {
if (pToken->z[0] == TS_ESCAPE_CHAR) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
}
char* sep = NULL;
if (escapeEnabled) {
......@@ -2870,13 +2875,13 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
return tscValidateName(pToken, escapeEnabled, NULL);
}
} else if (escapeEnabled && pToken->type == TK_ESCAPE) {
} else if (pToken->type == TK_ID) {
tscRmEscapeAndTrimToken(pToken);
return TSDB_CODE_SUCCESS;
return TSDB_CODE_SUCCESS;
} else {
if (isNumber(pToken)) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
}
}
} else { // two part
int32_t oldLen = pToken->n;
......@@ -2912,8 +2917,7 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
pToken->z = sep + 1;
pToken->n = (uint32_t)(oldLen - (sep - pStr) - 1);
int32_t len = tGetToken(pToken->z, &pToken->type);
if (len != pToken->n || (escapeEnabled && pToken->type != TK_STRING && pToken->type != TK_ID && pToken->type != TK_ESCAPE)
|| ((!escapeEnabled) && pToken->type != TK_STRING && pToken->type != TK_ID)) {
if (len != pToken->n || (pToken->type != TK_STRING && pToken->type != TK_ID)) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
......@@ -2925,7 +2929,7 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
}
}
if (escapeEnabled && pToken->type == TK_ESCAPE) {
if (escapeEnabled && pToken->type == TK_ID) {
tscRmEscapeAndTrimToken(pToken);
}
......
......@@ -94,6 +94,8 @@ void extractTableNameFromToken(SStrToken *pToken, SStrToken* pTable);
char *tableNameGetPosition(SStrToken* pToken, char target);
char *tableNameToStr(char *dst, char *src, char quote);
SSchema tGetUserSpecifiedColumnSchema(tVariant* pVal, SStrToken* exprStr, const char* name);
bool tscValidateTableNameLength(size_t len);
......
......@@ -154,27 +154,27 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, in
char *tableNameGetPosition(SStrToken* pToken, char target) {
bool inEscape = false;
bool inQuota = false;
bool inQuote = false;
char quotaStr = 0;
for (uint32_t i = 0; i < pToken->n; ++i) {
if (*(pToken->z + i) == target && (!inEscape) && (!inQuota)) {
if (*(pToken->z + i) == target && (!inEscape) && (!inQuote)) {
return pToken->z + i;
}
if (*(pToken->z + i) == TS_ESCAPE_CHAR) {
if (!inQuota) {
if (!inQuote) {
inEscape = !inEscape;
}
}
if (*(pToken->z + i) == '\'' || *(pToken->z + i) == '"') {
if (!inEscape) {
if (!inQuota) {
if (!inQuote) {
quotaStr = *(pToken->z + i);
inQuota = !inQuota;
inQuote = !inQuote;
} else if (quotaStr == *(pToken->z + i)) {
inQuota = !inQuota;
inQuote = !inQuote;
}
}
}
......@@ -183,6 +183,30 @@ char *tableNameGetPosition(SStrToken* pToken, char target) {
return NULL;
}
char *tableNameToStr(char *dst, char *src, char quote) {
*dst = 0;
if (src == NULL) {
return NULL;
}
int32_t len = (int32_t)strlen(src);
if (len <= 0) {
return NULL;
}
int32_t j = 0;
for (int32_t i = 0; i < len; ++i) {
if (*(src + i) == quote) {
*(dst + j++) = '\\';
}
*(dst + j++) = *(src + i);
}
return dst;
}
/*
* tablePrefix.columnName
......
......@@ -81,7 +81,7 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) {
case TSDB_DATA_TYPE_BINARY: {
pVar->pz = strndup(token->z, token->n);
pVar->nLen = strRmquote(pVar->pz, token->n);
pVar->nLen = strRmquoteEscape(pVar->pz, token->n);
break;
}
case TSDB_DATA_TYPE_TIMESTAMP: {
......
......@@ -103,116 +103,115 @@
#define TK_RP 85
#define TK_IF 86
#define TK_EXISTS 87
#define TK_ESCAPE 88
#define TK_AS 89
#define TK_OUTPUTTYPE 90
#define TK_AGGREGATE 91
#define TK_BUFSIZE 92
#define TK_PPS 93
#define TK_TSERIES 94
#define TK_DBS 95
#define TK_STORAGE 96
#define TK_QTIME 97
#define TK_CONNS 98
#define TK_STATE 99
#define TK_COMMA 100
#define TK_KEEP 101
#define TK_CACHE 102
#define TK_REPLICA 103
#define TK_QUORUM 104
#define TK_DAYS 105
#define TK_MINROWS 106
#define TK_MAXROWS 107
#define TK_BLOCKS 108
#define TK_CTIME 109
#define TK_WAL 110
#define TK_FSYNC 111
#define TK_COMP 112
#define TK_PRECISION 113
#define TK_UPDATE 114
#define TK_CACHELAST 115
#define TK_PARTITIONS 116
#define TK_UNSIGNED 117
#define TK_TAGS 118
#define TK_USING 119
#define TK_NULL 120
#define TK_NOW 121
#define TK_SELECT 122
#define TK_UNION 123
#define TK_ALL 124
#define TK_DISTINCT 125
#define TK_FROM 126
#define TK_VARIABLE 127
#define TK_INTERVAL 128
#define TK_EVERY 129
#define TK_SESSION 130
#define TK_STATE_WINDOW 131
#define TK_FILL 132
#define TK_SLIDING 133
#define TK_ORDER 134
#define TK_BY 135
#define TK_ASC 136
#define TK_GROUP 137
#define TK_HAVING 138
#define TK_LIMIT 139
#define TK_OFFSET 140
#define TK_SLIMIT 141
#define TK_SOFFSET 142
#define TK_WHERE 143
#define TK_RESET 144
#define TK_QUERY 145
#define TK_SYNCDB 146
#define TK_ADD 147
#define TK_COLUMN 148
#define TK_MODIFY 149
#define TK_TAG 150
#define TK_CHANGE 151
#define TK_SET 152
#define TK_KILL 153
#define TK_CONNECTION 154
#define TK_STREAM 155
#define TK_COLON 156
#define TK_ABORT 157
#define TK_AFTER 158
#define TK_ATTACH 159
#define TK_BEFORE 160
#define TK_BEGIN 161
#define TK_CASCADE 162
#define TK_CLUSTER 163
#define TK_CONFLICT 164
#define TK_COPY 165
#define TK_DEFERRED 166
#define TK_DELIMITERS 167
#define TK_DETACH 168
#define TK_EACH 169
#define TK_END 170
#define TK_EXPLAIN 171
#define TK_FAIL 172
#define TK_FOR 173
#define TK_IGNORE 174
#define TK_IMMEDIATE 175
#define TK_INITIALLY 176
#define TK_INSTEAD 177
#define TK_KEY 178
#define TK_OF 179
#define TK_RAISE 180
#define TK_REPLACE 181
#define TK_RESTRICT 182
#define TK_ROW 183
#define TK_STATEMENT 184
#define TK_TRIGGER 185
#define TK_VIEW 186
#define TK_IPTOKEN 187
#define TK_SEMI 188
#define TK_NONE 189
#define TK_PREV 190
#define TK_LINEAR 191
#define TK_IMPORT 192
#define TK_TBNAME 193
#define TK_JOIN 194
#define TK_INSERT 195
#define TK_INTO 196
#define TK_VALUES 197
#define TK_AS 88
#define TK_OUTPUTTYPE 89
#define TK_AGGREGATE 90
#define TK_BUFSIZE 91
#define TK_PPS 92
#define TK_TSERIES 93
#define TK_DBS 94
#define TK_STORAGE 95
#define TK_QTIME 96
#define TK_CONNS 97
#define TK_STATE 98
#define TK_COMMA 99
#define TK_KEEP 100
#define TK_CACHE 101
#define TK_REPLICA 102
#define TK_QUORUM 103
#define TK_DAYS 104
#define TK_MINROWS 105
#define TK_MAXROWS 106
#define TK_BLOCKS 107
#define TK_CTIME 108
#define TK_WAL 109
#define TK_FSYNC 110
#define TK_COMP 111
#define TK_PRECISION 112
#define TK_UPDATE 113
#define TK_CACHELAST 114
#define TK_PARTITIONS 115
#define TK_UNSIGNED 116
#define TK_TAGS 117
#define TK_USING 118
#define TK_NULL 119
#define TK_NOW 120
#define TK_SELECT 121
#define TK_UNION 122
#define TK_ALL 123
#define TK_DISTINCT 124
#define TK_FROM 125
#define TK_VARIABLE 126
#define TK_INTERVAL 127
#define TK_EVERY 128
#define TK_SESSION 129
#define TK_STATE_WINDOW 130
#define TK_FILL 131
#define TK_SLIDING 132
#define TK_ORDER 133
#define TK_BY 134
#define TK_ASC 135
#define TK_GROUP 136
#define TK_HAVING 137
#define TK_LIMIT 138
#define TK_OFFSET 139
#define TK_SLIMIT 140
#define TK_SOFFSET 141
#define TK_WHERE 142
#define TK_RESET 143
#define TK_QUERY 144
#define TK_SYNCDB 145
#define TK_ADD 146
#define TK_COLUMN 147
#define TK_MODIFY 148
#define TK_TAG 149
#define TK_CHANGE 150
#define TK_SET 151
#define TK_KILL 152
#define TK_CONNECTION 153
#define TK_STREAM 154
#define TK_COLON 155
#define TK_ABORT 156
#define TK_AFTER 157
#define TK_ATTACH 158
#define TK_BEFORE 159
#define TK_BEGIN 160
#define TK_CASCADE 161
#define TK_CLUSTER 162
#define TK_CONFLICT 163
#define TK_COPY 164
#define TK_DEFERRED 165
#define TK_DELIMITERS 166
#define TK_DETACH 167
#define TK_EACH 168
#define TK_END 169
#define TK_EXPLAIN 170
#define TK_FAIL 171
#define TK_FOR 172
#define TK_IGNORE 173
#define TK_IMMEDIATE 174
#define TK_INITIALLY 175
#define TK_INSTEAD 176
#define TK_KEY 177
#define TK_OF 178
#define TK_RAISE 179
#define TK_REPLACE 180
#define TK_RESTRICT 181
#define TK_ROW 182
#define TK_STATEMENT 183
#define TK_TRIGGER 184
#define TK_VIEW 185
#define TK_IPTOKEN 186
#define TK_SEMI 187
#define TK_NONE 188
#define TK_PREV 189
#define TK_LINEAR 190
#define TK_IMPORT 191
#define TK_TBNAME 192
#define TK_JOIN 193
#define TK_INSERT 194
#define TK_INTO 195
#define TK_VALUES 196
......
......@@ -2973,7 +2973,7 @@ static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *pMsg) {
int32_t num = 0;
int32_t code = TSDB_CODE_SUCCESS;
char* str = strndup(pInfo->tableNames, contLen);
char** nameList = strsplit(str, "·", &num);
char** nameList = strsplit(str, "`", &num);
SArray* pList = taosArrayInit(4, POINTER_BYTES);
SMultiTableMeta *pMultiMeta = NULL;
......
......@@ -91,10 +91,12 @@ dbPrefix(A) ::= ids(X) DOT. {A = X; }
cpxName(A) ::= . {A.n = 0; }
cpxName(A) ::= DOT ids(Y). {A = Y; A.n += 1; }
cmd ::= SHOW CREATE TABLE ftblname(X). {
cmd ::= SHOW CREATE TABLE ids(X) cpxName(Y). {
X.n += Y.n;
setDCLSqlElems(pInfo, TSDB_SQL_SHOW_CREATE_TABLE, 1, &X);
}
cmd ::= SHOW CREATE STABLE ftblname(X). {
}
cmd ::= SHOW CREATE STABLE ids(X) cpxName(Y). {
X.n += Y.n;
setDCLSqlElems(pInfo, TSDB_SQL_SHOW_CREATE_STABLE, 1, &X);
}
......@@ -106,7 +108,7 @@ cmd ::= SHOW dbPrefix(X) TABLES. {
setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &X, 0);
}
cmd ::= SHOW dbPrefix(X) TABLES LIKE tblname(Y). {
cmd ::= SHOW dbPrefix(X) TABLES LIKE ids(Y). {
setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &X, &Y);
}
......@@ -114,7 +116,7 @@ cmd ::= SHOW dbPrefix(X) STABLES. {
setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &X, 0);
}
cmd ::= SHOW dbPrefix(X) STABLES LIKE tblname(Y). {
cmd ::= SHOW dbPrefix(X) STABLES LIKE ids(Y). {
SStrToken token;
tSetDbName(&token, &X);
setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &token, &Y);
......@@ -133,12 +135,14 @@ cmd ::= SHOW dbPrefix(X) VGROUPS ids(Y). {
}
//drop configure for tables
cmd ::= DROP TABLE ifexists(Y) ftblname(X). {
cmd ::= DROP TABLE ifexists(Y) ids(X) cpxName(Z). {
X.n += Z.n;
setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &X, &Y, -1, -1);
}
//drop stable
cmd ::= DROP STABLE ifexists(Y) ftblname(X). {
cmd ::= DROP STABLE ifexists(Y) ids(X) cpxName(Z). {
X.n += Z.n;
setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &X, &Y, -1, TSDB_SUPER_TABLE);
}
......@@ -154,10 +158,13 @@ cmd ::= DROP ACCOUNT ids(X). { setDCLSqlElems(pInfo, TSDB_SQL_DROP_ACCT, 1,
cmd ::= USE ids(X). { setDCLSqlElems(pInfo, TSDB_SQL_USE_DB, 1, &X);}
/////////////////////////////////THE DESCRIBE STATEMENT/////////////////////////////////////
cmd ::= DESCRIBE ftblname(X). {
cmd ::= DESCRIBE ids(X) cpxName(Y). {
X.n += Y.n;
setDCLSqlElems(pInfo, TSDB_SQL_DESCRIBE_TABLE, 1, &X);
}
cmd ::= DESC ftblname(X). {
cmd ::= DESC ids(X) cpxName(Y). {
X.n += Y.n;
setDCLSqlElems(pInfo, TSDB_SQL_DESCRIBE_TABLE, 1, &X);
}
/////////////////////////////////THE ALTER STATEMENT////////////////////////////////////////
......@@ -192,14 +199,6 @@ ifexists(X) ::= . { X.n = 0;}
ifnotexists(X) ::= IF NOT EXISTS. { X.n = 1;}
ifnotexists(X) ::= . { X.n = 0;}
%type tblname {SStrToken}
tblname(A) ::= ids(X). {A = X; }
tblname(A) ::= ESCAPE(X). {A = X; }
%type ftblname {SStrToken}
ftblname(A) ::= tblname(X). {A = X; }
ftblname(A) ::= ids(X) DOT tblname(Y). {A = X; A.n += 1 + Y.n; }
/////////////////////////////////THE CREATE STATEMENT///////////////////////////////////////
//create option for dnode/db/user/account
cmd ::= CREATE DNODE ids(X). { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &X);}
......@@ -379,30 +378,36 @@ create_table_list(A) ::= create_table_list(X) create_from_stable(Z). {
}
%type create_table_args{SCreateTableSql*}
create_table_args(A) ::= ifnotexists(U) ftblname(V) LP columnlist(X) RP. {
create_table_args(A) ::= ifnotexists(U) ids(V) cpxName(Z) LP columnlist(X) RP. {
A = tSetCreateTableInfo(X, NULL, NULL, TSQL_CREATE_TABLE);
setSqlInfo(pInfo, A, NULL, TSDB_SQL_CREATE_TABLE);
V.n += Z.n;
setCreatedTableName(pInfo, &V, &U);
}
// create super table
%type create_stable_args{SCreateTableSql*}
create_stable_args(A) ::= ifnotexists(U) ftblname(V) LP columnlist(X) RP TAGS LP columnlist(Y) RP. {
create_stable_args(A) ::= ifnotexists(U) ids(V) cpxName(Z) LP columnlist(X) RP TAGS LP columnlist(Y) RP. {
A = tSetCreateTableInfo(X, Y, NULL, TSQL_CREATE_STABLE);
setSqlInfo(pInfo, A, NULL, TSDB_SQL_CREATE_TABLE);
V.n += Z.n;
setCreatedTableName(pInfo, &V, &U);
}
// create table by using super table
// create table table_name using super_table_name tags(tag_values1, tag_values2)
%type create_from_stable{SCreatedTableInfo}
create_from_stable(A) ::= ifnotexists(U) ftblname(V) USING ftblname(X) TAGS LP tagitemlist(Y) RP. {
create_from_stable(A) ::= ifnotexists(U) ids(V) cpxName(Z) USING ids(X) cpxName(F) TAGS LP tagitemlist(Y) RP. {
X.n += F.n;
V.n += Z.n;
A = createNewChildTableInfo(&X, NULL, Y, &V, &U);
}
create_from_stable(A) ::= ifnotexists(U) ftblname(V) USING ftblname(X) LP tagNamelist(P) RP TAGS LP tagitemlist(Y) RP. {
create_from_stable(A) ::= ifnotexists(U) ids(V) cpxName(Z) USING ids(X) cpxName(F) LP tagNamelist(P) RP TAGS LP tagitemlist(Y) RP. {
X.n += F.n;
V.n += Z.n;
A = createNewChildTableInfo(&X, P, Y, &V, &U);
}
......@@ -413,10 +418,11 @@ tagNamelist(A) ::= ids(X). {A = taosArrayInit(4, sizeof(SSt
// create stream
// create table table_name as select count(*) from super_table_name interval(time)
create_table_args(A) ::= ifnotexists(U) ftblname(V) AS select(S). {
create_table_args(A) ::= ifnotexists(U) ids(V) cpxName(Z) AS select(S). {
A = tSetCreateTableInfo(NULL, NULL, S, TSQL_CREATE_STREAM);
setSqlInfo(pInfo, A, NULL, TSDB_SQL_CREATE_TABLE);
V.n += Z.n;
setCreatedTableName(pInfo, &V, &U);
}
......@@ -543,19 +549,23 @@ sub(A) ::= sub(X) COMMA LP union(Y) RP ids(Z).{A = addSubqueryElem(X, Y, &Z);}
%type tablelist {SRelationInfo*}
%destructor tablelist {destroyRelationInfo($$);}
tablelist(A) ::= ftblname(X). {
tablelist(A) ::= ids(X) cpxName(Y). {
X.n += Y.n;
A = setTableNameList(NULL, &X, NULL);
}
tablelist(A) ::= ftblname(X) ids(Z). {
tablelist(A) ::= ids(X) cpxName(Y) ids(Z). {
X.n += Y.n;
A = setTableNameList(NULL, &X, &Z);
}
tablelist(A) ::= tablelist(Y) COMMA ftblname(X). {
tablelist(A) ::= tablelist(Y) COMMA ids(X) cpxName(Z). {
X.n += Z.n;
A = setTableNameList(Y, &X, NULL);
}
tablelist(A) ::= tablelist(Y) COMMA ftblname(X) ids(F). {
tablelist(A) ::= tablelist(Y) COMMA ids(X) cpxName(Z) ids(F). {
X.n += Z.n;
A = setTableNameList(Y, &X, &F);
}
......@@ -694,8 +704,6 @@ expr(A) ::= LP(X) expr(Y) RP(Z). {A = Y; A->exprToken.z = X.z; A->exprToke
expr(A) ::= ID(X). { A = tSqlExprCreateIdValue(&X, TK_ID);}
expr(A) ::= ID(X) DOT ID(Y). { X.n += (1+Y.n); A = tSqlExprCreateIdValue(&X, TK_ID);}
expr(A) ::= ID(X) DOT STAR(Y). { X.n += (1+Y.n); A = tSqlExprCreateIdValue(&X, TK_ALL);}
expr(A) ::= ESCAPE(X) DOT ID(Y). { X.n += (1+Y.n); A = tSqlExprCreateIdValue(&X, TK_ID);}
expr(A) ::= ESCAPE(X) DOT STAR(Y). { X.n += (1+Y.n); A = tSqlExprCreateIdValue(&X, TK_ALL);}
expr(A) ::= INTEGER(X). { A = tSqlExprCreateIdValue(&X, TK_INTEGER);}
expr(A) ::= MINUS(X) INTEGER(Y). { X.n += Y.n; X.type = TK_INTEGER; A = tSqlExprCreateIdValue(&X, TK_INTEGER);}
......@@ -769,12 +777,15 @@ cmd ::= RESET QUERY CACHE. { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
cmd ::= SYNCDB ids(X) REPLICA.{ setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &X);}
///////////////////////////////////ALTER TABLE statement//////////////////////////////////
cmd ::= ALTER TABLE ftblname(X) ADD COLUMN columnlist(A). {
cmd ::= ALTER TABLE ids(X) cpxName(F) ADD COLUMN columnlist(A). {
X.n += F.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER TABLE ftblname(X) DROP COLUMN ids(A). {
cmd ::= ALTER TABLE ids(X) cpxName(F) DROP COLUMN ids(A). {
X.n += F.n;
toTSDBType(A.type);
SArray* K = tVariantListAppendToken(NULL, &A, -1);
......@@ -782,17 +793,21 @@ cmd ::= ALTER TABLE ftblname(X) DROP COLUMN ids(A). {
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER TABLE ftblname(X) MODIFY COLUMN columnlist(A). {
cmd ::= ALTER TABLE ids(X) cpxName(F) MODIFY COLUMN columnlist(A). {
X.n += F.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
//////////////////////////////////ALTER TAGS statement/////////////////////////////////////
cmd ::= ALTER TABLE ftblname(X) ADD TAG columnlist(A). {
cmd ::= ALTER TABLE ids(X) cpxName(Y) ADD TAG columnlist(A). {
X.n += Y.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER TABLE ftblname(X) DROP TAG ids(Y). {
cmd ::= ALTER TABLE ids(X) cpxName(Z) DROP TAG ids(Y). {
X.n += Z.n;
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1);
......@@ -800,7 +815,8 @@ cmd ::= ALTER TABLE ftblname(X) DROP TAG ids(Y). {
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER TABLE ftblname(X) CHANGE TAG ids(Y) ids(Z). {
cmd ::= ALTER TABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). {
X.n += F.n;
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1);
......@@ -812,7 +828,8 @@ cmd ::= ALTER TABLE ftblname(X) CHANGE TAG ids(Y) ids(Z). {
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER TABLE ftblname(X) SET TAG ids(Y) EQ tagitem(Z). {
cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). {
X.n += F.n;
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1);
......@@ -822,18 +839,21 @@ cmd ::= ALTER TABLE ftblname(X) SET TAG ids(Y) EQ tagitem(Z). {
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER TABLE ftblname(X) MODIFY TAG columnlist(A). {
cmd ::= ALTER TABLE ids(X) cpxName(F) MODIFY TAG columnlist(A). {
X.n += F.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
///////////////////////////////////ALTER STABLE statement//////////////////////////////////
cmd ::= ALTER STABLE ftblname(X) ADD COLUMN columnlist(A). {
cmd ::= ALTER STABLE ids(X) cpxName(F) ADD COLUMN columnlist(A). {
X.n += F.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER STABLE ftblname(X) DROP COLUMN ids(A). {
cmd ::= ALTER STABLE ids(X) cpxName(F) DROP COLUMN ids(A). {
X.n += F.n;
toTSDBType(A.type);
SArray* K = tVariantListAppendToken(NULL, &A, -1);
......@@ -842,17 +862,20 @@ cmd ::= ALTER STABLE ftblname(X) DROP COLUMN ids(A). {
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER STABLE ftblname(X) MODIFY COLUMN columnlist(A). {
cmd ::= ALTER STABLE ids(X) cpxName(F) MODIFY COLUMN columnlist(A). {
X.n += F.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
//////////////////////////////////ALTER TAGS statement/////////////////////////////////////
cmd ::= ALTER STABLE ftblname(X) ADD TAG columnlist(A). {
cmd ::= ALTER STABLE ids(X) cpxName(Y) ADD TAG columnlist(A). {
X.n += Y.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER STABLE ftblname(X) DROP TAG ids(Y). {
cmd ::= ALTER STABLE ids(X) cpxName(Z) DROP TAG ids(Y). {
X.n += Z.n;
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1);
......@@ -861,7 +884,8 @@ cmd ::= ALTER STABLE ftblname(X) DROP TAG ids(Y). {
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER STABLE ftblname(X) CHANGE TAG ids(Y) ids(Z). {
cmd ::= ALTER STABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). {
X.n += F.n;
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1);
......@@ -873,7 +897,8 @@ cmd ::= ALTER STABLE ftblname(X) CHANGE TAG ids(Y) ids(Z). {
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER STABLE ftblname(X) SET TAG ids(Y) EQ tagitem(Z). {
cmd ::= ALTER STABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). {
X.n += F.n;
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1);
......@@ -883,7 +908,8 @@ cmd ::= ALTER STABLE ftblname(X) SET TAG ids(Y) EQ tagitem(Z). {
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER STABLE ftblname(X) MODIFY TAG columnlist(A). {
cmd ::= ALTER STABLE ids(X) cpxName(F) MODIFY TAG columnlist(A). {
X.n += F.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
......
此差异已折叠。
......@@ -27,6 +27,7 @@ extern "C" {
int32_t strdequote(char *src);
int32_t strRmquote(char *z, int32_t len);
int32_t strRmquoteEscape(char *z, int32_t len);
size_t strtrim(char *src);
char * strnchr(char *haystack, char needle, int32_t len, bool skipquote);
char ** strsplit(char *src, const char *delim, int32_t *num);
......
......@@ -228,8 +228,7 @@ static SKeyword keywordTable[] = {
{"FUNCTIONS", TK_FUNCTIONS},
{"OUTPUTTYPE", TK_OUTPUTTYPE},
{"AGGREGATE", TK_AGGREGATE},
{"BUFSIZE", TK_BUFSIZE},
{"ESCAPE", TK_ESCAPE}
{"BUFSIZE", TK_BUFSIZE}
};
static const char isIdChar[] = {
......@@ -447,7 +446,7 @@ uint32_t tGetToken(char* z, uint32_t* tokenId) {
for (i = 1; z[i]; i++) {
if (z[i] == '`') {
i++;
*tokenId = TK_ESCAPE;
*tokenId = TK_ID;
return i;
}
}
......
......@@ -84,6 +84,20 @@ int32_t strRmquote(char *z, int32_t len){
return len - 2 - cnt;
}
int32_t strRmquoteEscape(char *z, int32_t len) {
if (len <= 0) return len;
if (z[0] == '\'' || z[0] == '\"') {
return strRmquote(z, len);
} else if (len > 1 && z[0] == TS_ESCAPE_CHAR && z[len - 1] == TS_ESCAPE_CHAR) {
memmove(z, z + 1, len - 2);
return len - 2;
}
return len;
}
size_t strtrim(char *z) {
int32_t i = 0;
......
......@@ -17,6 +17,9 @@ sql_error create stable `dbesc`.stba (ts timestamp, f1 int) tags(t1 int);
sql create stable `!.!.!` (ts timestamp, f1 int) tags(t1 int);
sql create stable 'st1' (ts timestamp, f1 int) tags(t1 int) ;
sql create stable `st2` (ts timestamp, f1 int) tags(t1 int) ;
sql create stable dbesc.`st3` (ts timestamp, f1 int) tags(t1 int) ;
sql create table `***` (ts timestamp, f1 int) tags(t1 int);
sql create table `.,@` (ts timestamp, f1 int);
sql_error create table ',?,?,?' using dbesc.`!.!.!` tags(1);
......@@ -66,6 +69,31 @@ if $data00 != @21-09-22 10:10:13.000@ then
return -1
endi
sql select `.....`.*, `.....,`.* from dbesc.`.....`,dbesc.`.....,` where `.....`.ts=`.....,`.ts;
if $rows != 1 then
return -1
endi
if $data00 != @21-09-22 10:10:13.000@ then
return -1
endi
sql select a.*, b.* from dbesc.`.....` a,dbesc.`.....,` b where a.ts=b.ts;
if $rows != 1 then
return -1
endi
if $data00 != @21-09-22 10:10:13.000@ then
return -1
endi
#!!!!
sql select a.*, b.* from dbesc.`.....` 'a',dbesc.`.....,` 'b' where a.ts=b.ts;
if $rows != 1 then
return -1
endi
if $data00 != @21-09-22 10:10:13.000@ then
return -1
endi
sql select a.*, b.* from `.....` a,`.....,` b where a.ts=b.ts;
if $rows != 1 then
return -1
......@@ -74,8 +102,189 @@ if $data00 != @21-09-22 10:10:13.000@ then
return -1
endi
sql select * from `!.!.!` where tbname = `.....`;
sql insert into dbesc.`.....` values ('2021-09-22 10:10:18', 9);
sql insert into 'dbesc'.`.....` values ('2021-09-22 10:10:19', 10);
sql insert into "dbesc".`.....` values ('2021-09-22 10:10:20', 11);
sql_error select * from `!.!.!` where tbname = `.....`;
sql select * from `!.!.!` where tbname = '.....';
if $rows != 4 then
return -1
endi
if $data00 != @21-09-22 10:10:13.000@ then
return -1
endi
if $data10 != @21-09-22 10:10:18.000@ then
return -1
endi
if $data20 != @21-09-22 10:10:19.000@ then
return -1
endi
if $data30 != @21-09-22 10:10:20.000@ then
return -1
endi
sql select * from `!.!.!` where tbname = ".....";
if $rows != 4 then
return -1
endi
if $data00 != @21-09-22 10:10:13.000@ then
return -1
endi
if $data10 != @21-09-22 10:10:18.000@ then
return -1
endi
if $data20 != @21-09-22 10:10:19.000@ then
return -1
endi
if $data30 != @21-09-22 10:10:20.000@ then
return -1
endi
sql select * from `!.!.!` where tbname in (".....");
if $rows != 4 then
return -1
endi
if $data00 != @21-09-22 10:10:13.000@ then
return -1
endi
if $data10 != @21-09-22 10:10:18.000@ then
return -1
endi
if $data20 != @21-09-22 10:10:19.000@ then
return -1
endi
if $data30 != @21-09-22 10:10:20.000@ then
return -1
endi
sql select * from `!.!.!` where tbname like ".....";
if $rows != 4 then
return -1
endi
if $data00 != @21-09-22 10:10:13.000@ then
return -1
endi
if $data10 != @21-09-22 10:10:18.000@ then
return -1
endi
if $data20 != @21-09-22 10:10:19.000@ then
return -1
endi
if $data30 != @21-09-22 10:10:20.000@ then
return -1
endi
sql select * from `!.!.!` where tbname like "....%";
if $rows != 7 then
return -1
endi
if $data00 != @21-09-22 10:10:13.000@ then
return -1
endi
if $data10 != @21-09-22 10:10:18.000@ then
return -1
endi
if $data20 != @21-09-22 10:10:19.000@ then
return -1
endi
if $data30 != @21-09-22 10:10:20.000@ then
return -1
endi
if $data40 != @21-09-22 10:10:13.000@ then
return -1
endi
if $data50 != @21-09-22 10:10:14.000@ then
return -1
endi
if $data60 != @21-09-22 10:10:17.000@ then
return -1
endi
sql create table `select * from st1` (ts timestamp, f1 int);
sql create table `'"'"` (ts timestamp, f1 int);
sql create table `''""` using `!.!.!` tags (9);
sql SHOW CREATE TABLE `.....`;
sql SHOW CREATE TABLE dbesc.`.....`;
sql SHOW CREATE TABLE 'dbesc'.`.....`;
sql SHOW CREATE TABLE `!.!.!`;
sql SHOW CREATE TABLE `select * from st1`;
sql SHOW CREATE TABLE `'"'"`;
sql show create table `''""`;
sql_error SHOW CREATE STABLE `.....`;
sql SHOW CREATE STABLE `!.!.!`;
sql SHOW dbesc.TABLES LIKE '***';
if $rows != 0 then
return -1
endi
sql SHOW dbesc.STABLES LIKE '***';
if $rows != 1 then
return -1
endi
sql SHOW dbesc.TABLES LIKE '.....';
if $rows != 1 then
return -1
endi
sql SHOW dbesc.STABLES LIKE '.....';
if $rows != 0 then
return -1
endi
sql_error SHOW dbesc.TABLES LIKE `.....`;
sql_error SHOW dbesc.STABLES LIKE `***`;
sql show tables;
if $rows != 15 then
return -1
endi
sql_error drop table dbesc.'.....,,,1';
sql drop table dbesc.`.....,,,1`;
sql_error drop table dbesc.'.....,,';
sql drop table `.....,,`;
sql drop stable dbesc.'st1';
sql drop stable dbesc.`st2`;
sql drop stable dbesc.st3;
sql describe `.....`;
sql_error desc '.....';
sql_error ALTER TABLE `.....` ADD COLUMN f2 float;
sql ALTER TABLE `!.!.!` ADD COLUMN f2 float;
sql describe `!.!.!`;
if $rows != 4 then
return -1
endi
sql ALTER TABLE `!.!.!` DROP COLUMN f2;
sql_error ALTER TABLE `!.!.!` MODIFY COLUMN f2 int;
sql ALTER TABLE `!.!.!` ADD COLUMN f3 binary(10);
sql ALTER TABLE `!.!.!` MODIFY COLUMN f3 binary(11);
sql ALTER TABLE `!.!.!` ADD TAG t2 int;
sql ALTER TABLE `!.!.!` DROP TAG t2;
sql ALTER TABLE `!.!.!` ADD TAG ta binary(10);
sql ALTER TABLE `!.!.!` CHANGE TAG ta tb;
sql_error ALTER TABLE `!.!.!` SET TAG t1=99;
sql ALTER TABLE `.....` SET TAG t1=99;
sql ALTER TABLE `!.!.!` ADD TAG t3 binary(10);
sql ALTER TABLE `!.!.!` MODIFY TAG t3 binary(11);
sql ALTER STABLE `!.!.!` ADD COLUMN f4 binary(10);
sql ALTER STABLE `!.!.!` DROP COLUMN f4;
sql ALTER STABLE `!.!.!` ADD COLUMN f5 binary(10);
sql ALTER STABLE `!.!.!` MODIFY COLUMN f5 binary(12);
sql ALTER STABLE `!.!.!` ADD TAG t4 double;
sql ALTER STABLE `!.!.!` DROP TAG t4;
sql ALTER STABLE `!.!.!` ADD TAG t5 binary(1);
sql ALTER STABLE `!.!.!` CHANGE TAG t5 t6;
sql_error ALTER STABLE `!.!.!` SET TAG t6=999;
sql ALTER STABLE `!.!.!` MODIFY TAG t6 binary(12);
system sh/exec.sh -n dnode1 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册