提交 961c9547 编写于 作者: P plum-lihui

[issue #102]

上级 12b3ea1f
...@@ -206,6 +206,9 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -206,6 +206,9 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
pCmd->command = TSDB_SQL_USE_DB; pCmd->command = TSDB_SQL_USE_DB;
SSQLToken* pToken = &pInfo->pDCLInfo->a[0]; SSQLToken* pToken = &pInfo->pDCLInfo->a[0];
tscValidateName(pToken);
if (pToken->n > TSDB_DB_NAME_LEN) { if (pToken->n > TSDB_DB_NAME_LEN) {
setErrMsg(pCmd, msg, tListLen(msg)); setErrMsg(pCmd, msg, tListLen(msg));
return TSDB_CODE_INVALID_SQL; return TSDB_CODE_INVALID_SQL;
...@@ -390,15 +393,13 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -390,15 +393,13 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SSQLToken* pToken = &pInfo->pDCLInfo->a[0]; SSQLToken* pToken = &pInfo->pDCLInfo->a[0];
char msg[] = "table name is too long"; char msg[] = "table name is too long";
tscValidateName(pToken);
if (pToken->n > TSDB_METER_NAME_LEN) { if (pToken->n > TSDB_METER_NAME_LEN) {
setErrMsg(pCmd, msg, tListLen(msg)); setErrMsg(pCmd, msg, tListLen(msg));
return TSDB_CODE_INVALID_SQL; return TSDB_CODE_INVALID_SQL;
} }
strdequote(pToken->z);
strtrim(pToken->z);
pToken->n = strlen(pToken->z);
if (setMeterID(pSql, pToken) != TSDB_CODE_SUCCESS) { if (setMeterID(pSql, pToken) != TSDB_CODE_SUCCESS) {
setErrMsg(pCmd, msg, tListLen(msg)); setErrMsg(pCmd, msg, tListLen(msg));
return TSDB_CODE_INVALID_SQL; return TSDB_CODE_INVALID_SQL;
...@@ -569,6 +570,9 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -569,6 +570,9 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
// table name // table name
// metric name, create table by using dst // metric name, create table by using dst
SSQLToken* pToken = &(pInfo->pCreateTableInfo->usingInfo.metricName); SSQLToken* pToken = &(pInfo->pCreateTableInfo->usingInfo.metricName);
tscValidateName(pToken);
int32_t ret = setMeterID(pSql, pToken); int32_t ret = setMeterID(pSql, pToken);
if (ret != TSDB_CODE_SUCCESS) { if (ret != TSDB_CODE_SUCCESS) {
return ret; return ret;
...@@ -735,7 +739,8 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -735,7 +739,8 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return TSDB_CODE_INVALID_SQL; return TSDB_CODE_INVALID_SQL;
} }
strdequote(pQuerySql->from.z); tscValidateName(&(pQuerySql->from));
if (setMeterID(pSql, &pQuerySql->from) != TSDB_CODE_SUCCESS) { if (setMeterID(pSql, &pQuerySql->from) != TSDB_CODE_SUCCESS) {
char msg[] = "table name too long"; char msg[] = "table name too long";
setErrMsg(pCmd, msg, tListLen(msg)); setErrMsg(pCmd, msg, tListLen(msg));
...@@ -3472,6 +3477,8 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -3472,6 +3477,8 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SAlterTableSQL* pAlterSQL = pInfo->pAlterInfo; SAlterTableSQL* pAlterSQL = pInfo->pAlterInfo;
pCmd->command = TSDB_SQL_ALTER_TABLE; pCmd->command = TSDB_SQL_ALTER_TABLE;
tscValidateName(&(pAlterSQL->name));
if (setMeterID(pSql, &(pAlterSQL->name)) != TSDB_CODE_SUCCESS) { if (setMeterID(pSql, &(pAlterSQL->name)) != TSDB_CODE_SUCCESS) {
char msg[] = "table name too long"; char msg[] = "table name too long";
setErrMsg(pCmd, msg, tListLen(msg)); setErrMsg(pCmd, msg, tListLen(msg));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册