提交 022ec6b0 编写于 作者: G Ganlin Zhao

[TD-10700]<enhance>: The escape char backstick can be used for both tag name and column name

上级 57b60923
...@@ -3177,16 +3177,17 @@ static int16_t doGetColumnIndex(SQueryInfo* pQueryInfo, int32_t index, SStrToken ...@@ -3177,16 +3177,17 @@ static int16_t doGetColumnIndex(SQueryInfo* pQueryInfo, int32_t index, SStrToken
int16_t columnIndex = COLUMN_INDEX_INITIAL_VAL; int16_t columnIndex = COLUMN_INDEX_INITIAL_VAL;
if (pToken->type == TK_ID) { SStrToken tmpToken = *pToken;
tscRmEscapeAndTrimToken(pToken); if (tmpToken.type == TK_ID) {
tscRmEscapeAndTrimToken(&tmpToken);
} }
for (int16_t i = 0; i < numOfCols; ++i) { for (int16_t i = 0; i < numOfCols; ++i) {
if (pToken->n != strlen(pSchema[i].name)) { if (tmpToken.n != strlen(pSchema[i].name)) {
continue; continue;
} }
if (strncasecmp(pSchema[i].name, pToken->z, pToken->n) == 0) { if (strncasecmp(pSchema[i].name, tmpToken.z, tmpToken.n) == 0) {
columnIndex = i; columnIndex = i;
break; break;
} }
...@@ -7728,6 +7729,11 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { ...@@ -7728,6 +7729,11 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
for (int32_t i = 0; i < nameSize; ++i) { for (int32_t i = 0; i < nameSize; ++i) {
SStrToken* sToken = taosArrayGet(pNameList, i); SStrToken* sToken = taosArrayGet(pNameList, i);
char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW] = {0}; // create tmp buf to avoid alter orginal sqlstr
strncpy(tmpTokenBuf, sToken->z, sToken->n);
sToken->z = tmpTokenBuf;
if (TK_STRING == sToken->type) { if (TK_STRING == sToken->type) {
tscDequoteAndTrimToken(sToken); tscDequoteAndTrimToken(sToken);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册