lexer.nextToken();
WaspSqlShowCreateTableStatement stmt = new WaspSqlShowCreateTableStatement();
stmt.setName(this.exprParser.name());
return stmt;
}
throw new ParserException("TODO " + lexer.stringVal());
}
if (identifierEquals("GRANTS")) {
lexer.nextToken();
WaspSqlShowGrantsStatement stmt = new WaspSqlShowGrantsStatement();
if (lexer.token() == Token.FOR) {
lexer.nextToken();
stmt.setUser(this.exprParser.expr());
}
return stmt;
}
if (lexer.token() == Token.INDEX || identifierEquals("INDEXES")) {
lexer.nextToken();
WaspSqlShowIndexesStatement stmt = new WaspSqlShowIndexesStatement();
if (lexer.token() == Token.FROM || lexer.token() == Token.IN) {
lexer.nextToken();
SQLName table = exprParser.name();
stmt.setTable(table);
if (lexer.token() == Token.FROM || lexer.token() == Token.IN) {
lexer.nextToken();
SQLName database = exprParser.name();
stmt.setDatabase(database);
}
}
return stmt;
}
if (identifierEquals("OPEN")) {
lexer.nextToken();
acceptIdentifier(TABLES);
WaspSqlShowOpenTablesStatement stmt = new WaspSqlShowOpenTablesStatement();
if (lexer.token() == Token.FROM || lexer.token() == Token.IN) {
lexer.nextToken();
stmt.setDatabase(this.exprParser.name());
}
if (lexer.token() == Token.LIKE) {
lexer.nextToken();
stmt.setLike(this.exprParser.expr());
}
if (lexer.token() == Token.WHERE) {
lexer.nextToken();
stmt.setWhere(this.exprParser.expr());
}
return stmt;
}
if (identifierEquals("PROFILES")) {
lexer.nextToken();
WaspSqlShowProfilesStatement stmt = new WaspSqlShowProfilesStatement();
return stmt;
}
if (identifierEquals("PROFILE")) {
lexer.nextToken();
WaspSqlShowProfileStatement stmt = new WaspSqlShowProfileStatement();
for (;;) {
if (lexer.token() == Token.ALL) {
stmt.getTypes().add(WaspSqlShowProfileStatement.Type.ALL);
lexer.nextToken();
} else if (identifierEquals("BLOCK")) {
lexer.nextToken();
acceptIdentifier("IO");
stmt.getTypes().add(WaspSqlShowProfileStatement.Type.BLOCK_IO);
} else if (identifierEquals("CONTEXT")) {
lexer.nextToken();
acceptIdentifier("SWITCHES");
stmt.getTypes()
.add(WaspSqlShowProfileStatement.Type.CONTEXT_SWITCHES);
} else if (identifierEquals("CPU")) {
lexer.nextToken();
stmt.getTypes().add(WaspSqlShowProfileStatement.Type.CPU);
} else if (identifierEquals("IPC")) {
lexer.nextToken();
stmt.getTypes().add(WaspSqlShowProfileStatement.Type.IPC);
} else if (identifierEquals("MEMORY")) {
lexer.nextToken();
stmt.getTypes().add(WaspSqlShowProfileStatement.Type.MEMORY);
} else if (identifierEquals("PAGE")) {
lexer.nextToken();
acceptIdentifier("FAULTS");
stmt.getTypes().add(WaspSqlShowProfileStatement.Type.PAGE_FAULTS);
} else if (identifierEquals("SOURCE")) {
lexer.nextToken();
stmt.getTypes().add(WaspSqlShowProfileStatement.Type.SOURCE);
} else if (identifierEquals("SWAPS")) {
lexer.nextToken();
stmt.getTypes().add(WaspSqlShowProfileStatement.Type.SWAPS);
} else {
break;
}
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
break;
}
if (lexer.token() == Token.FOR) {
lexer.nextToken();
acceptIdentifier("QUERY");
stmt.setForQuery(this.exprParser.primary());
}
stmt.setLimit(this.parseLimit());
return stmt;
}
if (lexer.token() == Token.TABLE) {
lexer.nextToken();
acceptIdentifier(STATUS);
WaspSqlShowTableStatusStatement stmt = new WaspSqlShowTableStatusStatement();
if (lexer.token() == Token.FROM || lexer.token() == Token.IN) {
lexer.nextToken();
stmt.setDatabase(this.exprParser.name());
}
if (lexer.token() == Token.LIKE) {
lexer.nextToken();
stmt.setLike(this.exprParser.expr());
}
if (lexer.token() == Token.WHERE) {
lexer.nextToken();
stmt.setWhere(this.exprParser.expr());
}
return stmt;
}
throw new ParserException("TODO " + lexer.stringVal());
}