This commit is contained in:
junyu
2014-05-30 09:28:17 +08:00
parent d4fcdf60a4
commit 4770fce08c
4 changed files with 88 additions and 0 deletions
@@ -253,6 +253,10 @@ public class MySqlExprParser extends SQLExprParser {
} else if ("COLLATE".equalsIgnoreCase(lexer.stringVal())) {
lexer.nextToken();
if (lexer.token() == Token.EQ) {
lexer.nextToken();
}
if (lexer.token() != Token.IDENTIFIER) {
throw new ParserException("syntax error");
}
@@ -389,6 +389,11 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
print(x.getCollate());
}
}
if (x.getCollate() != null) {
print(" COLLATE ");
print(x.getCollate());
}
return false;
}
@@ -1371,7 +1371,17 @@ public class SQLExprParser extends SQLParser {
lexer.nextToken();
}
}
}else if(identifierEquals("COLLATE")){
lexer.nextToken();
if (lexer.token() != Token.IDENTIFIER) {
throw new ParserException();
}
charType.setCollate(lexer.stringVal());
lexer.nextToken();
}
return charType;
}