This commit is contained in:
Haojun Liao 2020-05-21 13:54:18 +08:00
parent bb088704d4
commit 8a8655b636
1 changed files with 10 additions and 13 deletions

View File

@ -590,31 +590,28 @@ SSQLToken tStrGetToken(char* str, int32_t* i, bool isPrevOptr, uint32_t numOfIgn
while (1) { while (1) {
*i += t0.n; *i += t0.n;
bool hasComma = false; int32_t numOfComma = 0;
while ((str[*i] == ' ' || str[*i] == '\n' || str[*i] == '\r' || str[*i] == '\t' || str[*i] == '\f') char t = str[*i];
|| str[*i] == ',') { while (t == ' ' || t == '\n' || t == '\r' || t == '\t' || t == '\f' || t == ',') {
if (str[*i] == ',') { if (t == ',' && (++numOfComma > 1)) { // comma only allowed once
if (false == hasComma) { t0.n = 0;
hasComma = true; return t0;
} else { // comma only allowed once
t0.n = 0;
return t0;
}
} }
(*i)++; (*i)++;
} }
t0.n = tSQLGetToken(&str[*i], &t0.type); t0.n = tSQLGetToken(&str[*i], &t0.type);
bool ignoreFlag = false; bool ignore = false;
for (uint32_t k = 0; k < numOfIgnoreToken; k++) { for (uint32_t k = 0; k < numOfIgnoreToken; k++) {
if (t0.type == ignoreTokenTypes[k]) { if (t0.type == ignoreTokenTypes[k]) {
ignoreFlag = true; ignore = true;
break; break;
} }
} }
if (!ignoreFlag) { if (!ignore) {
break; break;
} }
} }