odps support mysql quote, fixed issue #1292

This commit is contained in:
高铁
2016-06-29 23:59:44 +08:00
parent 022c0fe620
commit 7345e67f4a
4 changed files with 143 additions and 1 deletions
@@ -17,7 +17,6 @@ package com.alibaba.druid.sql.dialect.mysql.parser;
import static com.alibaba.druid.sql.parser.CharTypes.isFirstIdentifierChar;
import static com.alibaba.druid.sql.parser.LayoutCharacters.EOI;
import static com.alibaba.druid.sql.parser.Token.LITERAL_CHARS;
import java.util.HashMap;
import java.util.Map;
@@ -181,6 +181,34 @@ public class OdpsLexer extends Lexer {
public void scanIdentifier() {
final char first = ch;
if (first == '`') {
mark = pos;
bufPos = 1;
char ch;
for (;;) {
ch = charAt(++pos);
if (ch == '`') {
bufPos++;
ch = charAt(++pos);
break;
} else if (ch == EOI) {
throw new ParserException("illegal identifier");
}
bufPos++;
continue;
}
this.ch = charAt(pos);
stringVal = subString(mark, bufPos);
token = Token.IDENTIFIER;
return;
}
final boolean firstFlag = isFirstIdentifierChar(first);
if (!firstFlag) {