提交 3f066685 编写于 作者: wmmhello's avatar wmmhello

[TD-12252]<feature>(connector,query,insert,other,tools,taosAdapter):deal with escape character

上级 a31dc3af
...@@ -2918,7 +2918,7 @@ void tscColumnListDestroy(SArray* pColumnList) { ...@@ -2918,7 +2918,7 @@ void tscColumnListDestroy(SArray* pColumnList) {
* *
*/ */
static int32_t validateQuoteToken(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded) { static int32_t validateQuoteToken(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded) {
pToken->n = stringProcess(pToken->z, pToken->n); if(pToken->z != TS_BACKQUOTE_CHAR) pToken->n = stringProcess(pToken->z, pToken->n);
int32_t k = tGetToken(pToken->z, &pToken->type); int32_t k = tGetToken(pToken->z, &pToken->type);
...@@ -2957,7 +2957,7 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded) ...@@ -2957,7 +2957,7 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
if (pToken->type == TK_STRING) { if (pToken->type == TK_STRING) {
pToken->n = stringProcess(pToken->z, pToken->n); if(pToken->z[0] != TS_BACKQUOTE_CHAR) pToken->n = stringProcess(pToken->z, pToken->n);
// tscStrToLower(pToken->z, pToken->n); // tscStrToLower(pToken->z, pToken->n);
strntolower(pToken->z, pToken->z, pToken->n); strntolower(pToken->z, pToken->z, pToken->n);
//pToken->n = (uint32_t)strtrim(pToken->z); //pToken->n = (uint32_t)strtrim(pToken->z);
...@@ -2977,7 +2977,7 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded) ...@@ -2977,7 +2977,7 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
return tscValidateName(pToken, escapeEnabled, NULL); return tscValidateName(pToken, escapeEnabled, NULL);
} }
} else if (pToken->type == TK_ID) { } else if (pToken->type == TK_ID) {
pToken->n = stringProcess(pToken->z, pToken->n); if(pToken->z[0] == TS_BACKQUOTE_CHAR) pToken->n = stringProcess(pToken->z, pToken->n);
if (pToken->n == 0) { if (pToken->n == 0) {
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
...@@ -3038,7 +3038,7 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded) ...@@ -3038,7 +3038,7 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
} }
if (escapeEnabled && pToken->type == TK_ID) { if (escapeEnabled && pToken->type == TK_ID) {
pToken->n = stringProcess(pToken->z, pToken->n); if(pToken->z[0] == TS_BACKQUOTE_CHAR) pToken->n = stringProcess(pToken->z, pToken->n);
} }
// re-build the whole name string // re-build the whole name string
......
...@@ -141,7 +141,6 @@ size_t strtrim(char *z) { ...@@ -141,7 +141,6 @@ size_t strtrim(char *z) {
} else if (j != i) { } else if (j != i) {
z[i] = 0; z[i] = 0;
} }
return i; return i;
} }
...@@ -197,7 +196,7 @@ char *tstrstr(char *src, char *dst, bool ignoreInEsc) { ...@@ -197,7 +196,7 @@ char *tstrstr(char *src, char *dst, bool ignoreInEsc) {
bool inEsc = false; bool inEsc = false;
char escChar = 0; char escChar = 0;
char *str = src, *res = NULL; char *str = src, *res = NULL;
for (int32_t i = 0; i < len; ++i) { for (int32_t i = 0; i < len; ++i) {
if (src[i] == TS_BACKQUOTE_CHAR || src[i] == '\'' || src[i] == '\"') { if (src[i] == TS_BACKQUOTE_CHAR || src[i] == '\'' || src[i] == '\"') {
if (!inEsc) { if (!inEsc) {
...@@ -216,7 +215,7 @@ char *tstrstr(char *src, char *dst, bool ignoreInEsc) { ...@@ -216,7 +215,7 @@ char *tstrstr(char *src, char *dst, bool ignoreInEsc) {
str = src + i + 1; str = src + i + 1;
} }
inEsc = !inEsc; inEsc = !inEsc;
continue; continue;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册