提交 63903b26 编写于 作者: wmmhello's avatar wmmhello

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

上级 eed7ebdd
......@@ -50,7 +50,7 @@ SSchema tGetUserSpecifiedColumnSchema(tVariant* pVal, SStrToken* exprStr, const
} else {
size_t tlen = MIN(sizeof(s.name), exprStr->n + 1);
tstrncpy(s.name, exprStr->z, tlen);
stringProcess(s.name, strlen(s.name));
stringProcess(s.name, (int32_t)strlen(s.name));
}
return s;
......
......@@ -96,7 +96,7 @@ SArray *tSqlExprListAppend(SArray *pList, tSqlExpr *pNode, SStrToken *pDistinct,
strncpy(item.aliasName, pToken->z, pToken->n);
item.aliasName[pToken->n] = 0;
stringProcess(item.aliasName, strlen(item.aliasName));
stringProcess(item.aliasName, (int32_t)strlen(item.aliasName));
}
taosArrayPush(pList, &item);
......
......@@ -448,13 +448,13 @@ uint32_t tGetToken(char* z, uint32_t* tokenId) {
}
case '`': {
for (i = 1; z[i]; i++) {
if(isprint(z[i]) == 0){
break;
}
if (z[i] == '`' && z[i+1] == '`') {
i++;
continue;
}
// if(isprint(z[i]) == 0){
// break;
// }
// if (z[i] == '`' && z[i+1] == '`') {
// i++;
// continue;
// }
if (z[i] == '`') {
i++;
*tokenId = TK_ID;
......
......@@ -78,6 +78,8 @@ int32_t strDealWithEscape(char *z, int32_t len){
static int32_t strdequote(char *z, int32_t n){
if(z == NULL || n < 2) return n;
int32_t quote = z[0];
z[0] = 0;
z[n - 1] = 0;
int32_t i = 1, j = 0;
while (i < n) {
if (i < n - 1 && z[i] == quote && z[i + 1] == quote) { // two consecutive quotation marks keep one
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册