commit
e1d87d3406
|
@ -902,12 +902,16 @@ int32_t parseSlidingClause(SSqlObj* pSql, SQueryInfo* pQueryInfo, SQuerySQL* pQu
|
||||||
|
|
||||||
int32_t tscSetTableFullName(STableMetaInfo* pTableMetaInfo, SStrToken* pTableName, SSqlObj* pSql) {
|
int32_t tscSetTableFullName(STableMetaInfo* pTableMetaInfo, SStrToken* pTableName, SSqlObj* pSql) {
|
||||||
const char* msg1 = "name too long";
|
const char* msg1 = "name too long";
|
||||||
|
const char* msg2 = "acctId too long";
|
||||||
|
|
||||||
SSqlCmd* pCmd = &pSql->cmd;
|
SSqlCmd* pCmd = &pSql->cmd;
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
if (hasSpecifyDB(pTableName)) { // db has been specified in sql string so we ignore current db path
|
if (hasSpecifyDB(pTableName)) { // db has been specified in sql string so we ignore current db path
|
||||||
tNameSetAcctId(&pTableMetaInfo->name, getAccountId(pSql));
|
code = tNameSetAcctId(&pTableMetaInfo->name, getAccountId(pSql));
|
||||||
|
if (code != 0) {
|
||||||
|
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
|
||||||
|
}
|
||||||
|
|
||||||
char name[TSDB_TABLE_FNAME_LEN] = {0};
|
char name[TSDB_TABLE_FNAME_LEN] = {0};
|
||||||
strncpy(name, pTableName->z, pTableName->n);
|
strncpy(name, pTableName->z, pTableName->n);
|
||||||
|
|
|
@ -367,6 +367,9 @@ int32_t tNameSetAcctId(SName* dst, const char* acct) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tstrncpy(dst->acctId, acct, tListLen(dst->acctId));
|
tstrncpy(dst->acctId, acct, tListLen(dst->acctId));
|
||||||
|
|
||||||
|
assert(strlen(dst->acctId) > 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,12 +386,14 @@ int32_t tNameFromString(SName* dst, const char* str, uint32_t type) {
|
||||||
int32_t len = (int32_t)(p - str);
|
int32_t len = (int32_t)(p - str);
|
||||||
|
|
||||||
// too long account id or too long db name
|
// too long account id or too long db name
|
||||||
if (len >= tListLen(dst->acctId) || len == 0) {
|
if ((len >= tListLen(dst->acctId)) || (len <= 0)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy (dst->acctId, str, len);
|
memcpy (dst->acctId, str, len);
|
||||||
dst->acctId[len] = 0;
|
dst->acctId[len] = 0;
|
||||||
|
|
||||||
|
assert(strlen(dst->acctId) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type & T_NAME_DB) == T_NAME_DB) {
|
if ((type & T_NAME_DB) == T_NAME_DB) {
|
||||||
|
@ -404,7 +409,7 @@ int32_t tNameFromString(SName* dst, const char* str, uint32_t type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// too long account id or too long db name
|
// too long account id or too long db name
|
||||||
if (len >= tListLen(dst->dbname) || len == 0) {
|
if ((len >= tListLen(dst->dbname)) || (len <= 0)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +424,7 @@ int32_t tNameFromString(SName* dst, const char* str, uint32_t type) {
|
||||||
int32_t len = (int32_t) strlen(start);
|
int32_t len = (int32_t) strlen(start);
|
||||||
|
|
||||||
// too long account id or too long db name
|
// too long account id or too long db name
|
||||||
if (len >= tListLen(dst->tname) || len == 0) {
|
if ((len >= tListLen(dst->tname)) || (len <= 0)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue