本文整理汇总了Java中net.sf.jsqlparser.statement.select.PlainSelect类的典型用法代码示例。如果您正苦于以下问题:Java PlainSelect类的具体用法?Java PlainSelect怎么用?Java PlainSelect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlainSelect类属于net.sf.jsqlparser.statement.select包,在下文中一共展示了PlainSelect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSelectParameters
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
private void setSelectParameters(SelectBody body, com.google.cloud.spanner.Statement.Builder builder)
{
if (body instanceof PlainSelect)
{
setPlainSelectParameters((PlainSelect) body, builder);
}
else
{
body.accept(new SelectVisitorAdapter()
{
@Override
public void visit(PlainSelect plainSelect)
{
setPlainSelectParameters(plainSelect, builder);
}
});
}
}
示例2: toString
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("GROUP_CONCAT(");
if (isDistinct()) {
b.append("DISTINCT ");
}
b.append(PlainSelect.getStringList(expressionList.getExpressions(), true, false));
if (orderByElements != null && !orderByElements.isEmpty()) {
b.append(" ORDER BY ");
for (int i = 0; i < orderByElements.size(); i++) {
if (i > 0) {
b.append(", ");
}
b.append(orderByElements.get(i).toString());
}
}
if (separator != null) {
b.append(" SEPARATOR ").append(separator);
}
b.append(")");
return b.toString();
}
示例3: toString
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
@Override
public String toString() {
StringBuilder sql = new StringBuilder("CREATE ");
if (isOrReplace()) {
sql.append("OR REPLACE ");
}
if (isMaterialized()) {
sql.append("MATERIALIZED ");
}
sql.append("VIEW ");
sql.append(view);
if (columnNames != null) {
sql.append(PlainSelect.getStringList(columnNames, true, true));
}
sql.append(" AS ").append(selectBody);
return sql.toString();
}
示例4: visit
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
@Override
public void visit(PlainSelect plainSelect) {
for (SelectItem item : plainSelect.getSelectItems()) {
item.accept(this);
}
if (itemsExpr.size() > 1) {
BinaryExpression binExpr = createBinaryExpression();
binExpr.setLeftExpression(itemsExpr.get(0).getExpression());
for (int i = 1; i < itemsExpr.size() - 1; i++) {
binExpr.setRightExpression(itemsExpr.get(i).getExpression());
BinaryExpression binExpr2 = createBinaryExpression();
binExpr2.setLeftExpression(binExpr);
binExpr = binExpr2;
}
binExpr.setRightExpression(itemsExpr.get(itemsExpr.size() - 1).getExpression());
SelectExpressionItem sei = new SelectExpressionItem();
sei.setExpression(binExpr);
plainSelect.getSelectItems().clear();
plainSelect.getSelectItems().add(sei);
}
((SelectExpressionItem) plainSelect.getSelectItems().get(0)).setAlias(new Alias(alias));
}
示例5: visit
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
@Override
public void visit(PivotXml pivot) {
List<Column> forColumns = pivot.getForColumns();
buffer.append(" PIVOT XML (")
.append(PlainSelect.getStringList(pivot.getFunctionItems()))
.append(" FOR ")
.append(PlainSelect.getStringList(forColumns, true, forColumns != null && forColumns.size() > 1))
.append(" IN (");
if (pivot.isInAny()) {
buffer.append("ANY");
} else if (pivot.getInSelect() != null) {
buffer.append(pivot.getInSelect());
} else {
buffer.append(PlainSelect.getStringList(pivot.getInItems()));
}
buffer.append("))");
}
示例6: deParse
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
public void deParse(CreateView createView) {
buffer.append("CREATE ");
if (createView.isOrReplace()) {
buffer.append("OR REPLACE ");
}
if (createView.isMaterialized()) {
buffer.append("MATERIALIZED ");
}
buffer.append("VIEW ").append(createView.getView().getFullyQualifiedName());
if (createView.getColumnNames() != null) {
buffer.append(PlainSelect.getStringList(createView.getColumnNames(), true, true));
}
buffer.append(" AS ");
createView.getSelectBody().accept(selectVisitor);
}
示例7: addExpression
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
/**
* Adds an expression to select statements. E.g. a simple column is an
* expression.
*
* @param select
* @param expr
*/
public static void addExpression(Select select, final Expression expr) {
select.getSelectBody().accept(new SelectVisitor() {
@Override
public void visit(PlainSelect plainSelect) {
plainSelect.getSelectItems().add(new SelectExpressionItem(expr));
}
@Override
public void visit(SetOperationList setOpList) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
@Override
public void visit(WithItem withItem) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
});
}
示例8: addJoin
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
/**
* Adds a simple join to a select statement. The introduced join is returned for
* more configuration settings on it (e.g. left join, right join).
* @param select
* @param table
* @param onExpression
* @return
*/
public static Join addJoin(Select select, final Table table, final Expression onExpression) {
if (select.getSelectBody() instanceof PlainSelect) {
PlainSelect plainSelect = (PlainSelect) select.getSelectBody();
List<Join> joins = plainSelect.getJoins();
if (joins == null) {
joins = new ArrayList<Join>();
plainSelect.setJoins(joins);
}
Join join = new Join();
join.setRightItem(table);
join.setOnExpression(onExpression);
joins.add(join);
return join;
}
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
示例9: addGroupBy
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
/**
* Adds group by to a plain select statement.
* @param select
* @param expr
*/
public static void addGroupBy(Select select, final Expression expr) {
select.getSelectBody().accept(new SelectVisitor() {
@Override
public void visit(PlainSelect plainSelect) {
plainSelect.addGroupByColumnReference(expr);
}
@Override
public void visit(SetOperationList setOpList) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
@Override
public void visit(WithItem withItem) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
});
}
示例10: visit
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
@Override
public void visit(PlainSelect plainSelect) {
if (plainSelect.getSelectItems() != null) {
for (SelectItem item : plainSelect.getSelectItems()) {
item.accept(this);
}
}
if (plainSelect.getFromItem() != null) {
plainSelect.getFromItem().accept(this);
}
if (plainSelect.getJoins() != null) {
for (Join join : plainSelect.getJoins()) {
join.getRightItem().accept(this);
}
}
if (plainSelect.getWhere() != null) {
plainSelect.getWhere().accept(this);
}
if (plainSelect.getOracleHierarchical() != null) {
plainSelect.getOracleHierarchical().accept(this);
}
}
示例11: executeSubquery
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
public List<DataAccessor> executeSubquery(PlainSelect select) throws StatementExecutionException {
List<DataAccessor> cached = subqueryCache.get(select);
if (cached != null) {
return cached;
}
LOGGER.log(Level.SEVERE, "executing subquery {0}", select);
ExecutionPlan plan = compileSubplan(select);
try (ScanResult result = (ScanResult) manager.executePlan(plan, this, transactionContext);) {
List<DataAccessor> fullResult = result.dataScanner.consume();
LOGGER.log(Level.SEVERE, "executing subquery " + select + " -> " + fullResult);
subqueryCache.put(select, fullResult);
return fullResult;
} catch (DataScannerException error) {
throw new StatementExecutionException(error);
}
}
示例12: CompiledInExpression
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
public CompiledInExpression(boolean not, CompiledSQLExpression left,
List<CompiledSQLExpression> inExpressions, SubSelect inSubSelect) {
this.left = left;
this.not = not;
this.inExpressions = inExpressions;
if (inSubSelect != null) {
if (inSubSelect.getSelectBody() instanceof PlainSelect) {
this.inSubSelectPlain = (PlainSelect) inSubSelect.getSelectBody();
} else {
throw new StatementExecutionException("unsupported operand \"IN\""
+ " with subquery of type " + inSubSelect.getSelectBody().getClass()
+ "(" + inSubSelect.getSelectBody() + ")");
}
} else {
this.inSubSelectPlain = null;
}
}
示例13: processSelectBody
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
/**
* select 语句处理
*/
@Override
public void processSelectBody(SelectBody selectBody) {
if (selectBody instanceof PlainSelect) {
processPlainSelect((PlainSelect) selectBody);
} else if (selectBody instanceof WithItem) {
WithItem withItem = (WithItem) selectBody;
if (withItem.getSelectBody() != null) {
processSelectBody(withItem.getSelectBody());
}
} else {
SetOperationList operationList = (SetOperationList) selectBody;
if (operationList.getSelects() != null && operationList.getSelects().size() > 0) {
List<SelectBody> plainSelects = operationList.getSelects();
for (SelectBody plainSelect : plainSelects) {
processSelectBody(plainSelect);
}
}
}
}
示例14: processInsert
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
/**
* <p>
* insert 语句处理
* </p>
*/
@Override
public void processInsert(Insert insert) {
if (this.tenantHandler.doTableFilter(insert.getTable().getName())) {
// 过滤退出执行
return;
}
insert.getColumns().add(new Column(this.tenantHandler.getTenantIdColumn()));
if (insert.getSelect() != null) {
processPlainSelect((PlainSelect) insert.getSelect().getSelectBody(), true);
} else if (insert.getItemsList() != null) {
((ExpressionList) insert.getItemsList()).getExpressions().add(tenantHandler.getTenantId());
} else {
throw new MybatisPlusException("Failed to process multiple-table update, please exclude the tableName or statementId");
}
}
示例15: processPlainSelect
import net.sf.jsqlparser.statement.select.PlainSelect; //导入依赖的package包/类
/**
* <p>
* 处理 PlainSelect
* </p>
*
* @param plainSelect
* @param addColumn 是否添加租户列,insert into select语句中需要
*/
protected void processPlainSelect(PlainSelect plainSelect, boolean addColumn) {
FromItem fromItem = plainSelect.getFromItem();
if (fromItem instanceof Table) {
Table fromTable = (Table) fromItem;
if (this.tenantHandler.doTableFilter(fromTable.getName())) {
// 过滤退出执行
return;
}
plainSelect.setWhere(builderExpression(plainSelect.getWhere(), fromTable));
if (addColumn) {
plainSelect.getSelectItems().add(new SelectExpressionItem(new Column(this.tenantHandler.getTenantIdColumn())));
}
} else {
processFromItem(fromItem);
}
List<Join> joins = plainSelect.getJoins();
if (joins != null && joins.size() > 0) {
for (Join join : joins) {
processJoin(join);
processFromItem(join.getRightItem());
}
}
}