use of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock in project druid by alibaba.
the class SQLSelectBuilderImpl method select.
public SQLSelectBuilderImpl select(String... columns) {
SQLSelectQueryBlock queryBlock = getQueryBlock();
for (String column : columns) {
SQLSelectItem selectItem = SQLUtils.toSelectItem(column, dbType);
queryBlock.addSelectItem(selectItem);
}
return this;
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock in project druid by alibaba.
the class SQLSelectBuilderImpl method groupBy.
@Override
public SQLSelectBuilderImpl groupBy(String expr) {
SQLSelectQueryBlock queryBlock = getQueryBlock();
SQLSelectGroupByClause groupBy = queryBlock.getGroupBy();
if (groupBy == null) {
groupBy = createGroupBy();
queryBlock.setGroupBy(groupBy);
}
SQLExpr exprObj = SQLUtils.toSQLExpr(expr, dbType);
groupBy.addItem(exprObj);
return this;
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock in project druid by alibaba.
the class SQLSelectBuilderImpl method from.
@Override
public SQLSelectBuilderImpl from(String table, String alias) {
SQLSelectQueryBlock queryBlock = getQueryBlock();
SQLExprTableSource from = new SQLExprTableSource(new SQLIdentifierExpr(table), alias);
queryBlock.setFrom(from);
return this;
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock in project druid by alibaba.
the class SQLSelectBuilderImpl method having.
@Override
public SQLSelectBuilderImpl having(String expr) {
SQLSelectQueryBlock queryBlock = getQueryBlock();
SQLSelectGroupByClause groupBy = queryBlock.getGroupBy();
if (groupBy == null) {
groupBy = createGroupBy();
queryBlock.setGroupBy(groupBy);
}
SQLExpr exprObj = SQLUtils.toSQLExpr(expr, dbType);
groupBy.setHaving(exprObj);
return this;
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock in project druid by alibaba.
the class SQLSelectBuilderImpl method selectWithAlias.
@Override
public SQLSelectBuilderImpl selectWithAlias(String column, String alias) {
SQLSelectQueryBlock queryBlock = getQueryBlock();
SQLExpr columnExpr = SQLUtils.toSQLExpr(column, dbType);
SQLSelectItem selectItem = new SQLSelectItem(columnExpr, alias);
queryBlock.addSelectItem(selectItem);
return this;
}
Aggregations