use of com.alibaba.cobar.parser.ast.stmt.dal.ShowColumns in project cobar by alibaba.
the class MySQLDALParser method showColumns.
/**
* First token is {@link SpecialIdentifier#COLUMNS}
*
* <pre>
* SHOW [FULL] <code>COLUMNS {FROM | IN} tbl_name [{FROM | IN} db_name] [LIKE 'pattern' | WHERE expr] </code>
* </pre>
*/
private ShowColumns showColumns(boolean full) throws SQLSyntaxErrorException {
lexer.nextToken();
match(KW_FROM, KW_IN);
Identifier table = identifier();
Identifier database = null;
switch(lexer.token()) {
case KW_FROM:
case KW_IN:
lexer.nextToken();
database = identifier();
}
switch(lexer.token()) {
case KW_LIKE:
String like = like();
return new ShowColumns(full, table, database, like);
case KW_WHERE:
Expression where = where();
return new ShowColumns(full, table, database, where);
}
return new ShowColumns(full, table, database);
}
Aggregations