use of com.alibaba.druid.sql.ast.statement.SQLSelect in project druid by alibaba.
the class SQLSelectBuilderImpl method getQueryBlock.
protected SQLSelectQueryBlock getQueryBlock() {
SQLSelect select = getSQLSelect();
SQLSelectQuery query = select.getQuery();
if (query == null) {
query = createSelectQueryBlock();
select.setQuery(query);
}
if (!(query instanceof SQLSelectQueryBlock)) {
throw new IllegalStateException("not support from, class : " + query.getClass().getName());
}
SQLSelectQueryBlock queryBlock = (SQLSelectQueryBlock) query;
return queryBlock;
}
use of com.alibaba.druid.sql.ast.statement.SQLSelect in project druid by alibaba.
the class SQLSelectBuilderImpl method orderBy.
@Override
public SQLSelectBuilderImpl orderBy(String... columns) {
SQLSelect select = this.getSQLSelect();
SQLOrderBy orderBy = select.getOrderBy();
if (orderBy == null) {
orderBy = createOrderBy();
select.setOrderBy(orderBy);
}
for (String column : columns) {
SQLSelectOrderByItem orderByItem = SQLUtils.toOrderByItem(column, dbType);
orderBy.addItem(orderByItem);
}
return this;
}
use of com.alibaba.druid.sql.ast.statement.SQLSelect in project druid by alibaba.
the class PGSQLStatementParser method parseSelect.
public PGSelectStatement parseSelect() {
PGSelectParser selectParser = createSQLSelectParser();
SQLSelect select = selectParser.select();
return new PGSelectStatement(select);
}
use of com.alibaba.druid.sql.ast.statement.SQLSelect in project druid by alibaba.
the class SQLExprParser method parseAll.
protected SQLExpr parseAll() {
SQLExpr sqlExpr;
lexer.nextToken();
SQLAllExpr allExpr = new SQLAllExpr();
accept(Token.LPAREN);
SQLSelect allSubQuery = createSelectParser().select();
allExpr.setSubQuery(allSubQuery);
accept(Token.RPAREN);
allSubQuery.setParent(allExpr);
sqlExpr = allExpr;
return sqlExpr;
}
use of com.alibaba.druid.sql.ast.statement.SQLSelect in project druid by alibaba.
the class SQLExprParser method parseSome.
protected SQLExpr parseSome() {
SQLExpr sqlExpr;
lexer.nextToken();
SQLSomeExpr someExpr = new SQLSomeExpr();
accept(Token.LPAREN);
SQLSelect someSubQuery = createSelectParser().select();
someExpr.setSubQuery(someSubQuery);
accept(Token.RPAREN);
someSubQuery.setParent(someExpr);
sqlExpr = someExpr;
return sqlExpr;
}
Aggregations