net.sf.jsqlparser.expression.operators.relational.ExpressionList Java Examples
The following examples show how to use
net.sf.jsqlparser.expression.operators.relational.ExpressionList.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ListExpressionConverter.java From sqlhelper with GNU Lesser General Public License v3.0 | 5 votes |
@Override public ValueListExpression toJSqlParserExpression(ListExpression expression) { ExpressionList expressionList = ExpressionConverters.toJSqlParserExpressionList(expression); ValueListExpression valueListExpression = new ValueListExpression(); valueListExpression.setExpressionList(expressionList); return valueListExpression; }
Example #2
Source File: ExpressionConverters.java From sqlhelper with GNU Lesser General Public License v3.0 | 5 votes |
public static ExpressionList toJSqlParserExpressionList(final ListExpression expression) { List<Expression> expressions = Pipeline.of(expression.getExpressions()).map(new Function<SQLExpression, Expression>() { @Override public Expression apply(SQLExpression input) { return toJSqlParserExpression(expression); } }).asList(); ExpressionList result = new ExpressionList(); result.setExpressions(expressions); return result; }
Example #3
Source File: ItemsListVisitorImpl.java From DataPermissionHelper with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public void visit(ExpressionList el) { List<Expression> list = el.getExpressions(); if (list != null && list.size() > 0) { for (Expression expr : list) { expr.accept(new ExpressionVisitorImpl()); } } }
Example #4
Source File: DMLWhereClauseVisitorAdapter.java From spanner-jdbc with MIT License | 4 votes |
@Override public void visit(ExpressionList expressionList) { invalid = true; super.visit(expressionList); }
Example #5
Source File: CloudSpannerPreparedStatement.java From spanner-jdbc with MIT License | 4 votes |
private Mutation createInsertMutation(Insert insert, boolean generateParameterMetaData) throws SQLException { ItemsList items = insert.getItemsList(); if (generateParameterMetaData && items == null && insert.getSelect() != null) { // Just initialize the parameter meta data of the select statement createSelectBuilder(insert.getSelect(), insert.getSelect().toString()); return null; } if (!(items instanceof ExpressionList)) { throw new CloudSpannerSQLException("Insert statement must specify a list of values", Code.INVALID_ARGUMENT); } if (insert.getColumns() == null || insert.getColumns().isEmpty()) { throw new CloudSpannerSQLException("Insert statement must specify a list of column names", Code.INVALID_ARGUMENT); } List<Expression> expressions = ((ExpressionList) items).getExpressions(); String table = unquoteIdentifier(insert.getTable().getFullyQualifiedName()); getParameterStore().setTable(table); WriteBuilder builder; if (insert.isUseDuplicate()) { /** * Do an insert-or-update. BUT: Cloud Spanner does not support supplying different values for * the insert and update statements, meaning that only the values specified in the INSERT part * of the statement will be considered. Anything specified in the 'ON DUPLICATE KEY UPDATE * ...' statement will be ignored. */ if (this.forceUpdate) builder = Mutation.newUpdateBuilder(table); else builder = Mutation.newInsertOrUpdateBuilder(table); } else { /** * Just do an insert and throw an error if a row with the specified key alread exists. */ builder = Mutation.newInsertBuilder(table); } int index = 0; for (Column col : insert.getColumns()) { String columnName = unquoteIdentifier(col.getFullyQualifiedName()); expressions.get(index).accept(new ValueBinderExpressionVisitorAdapter<>(getParameterStore(), builder.set(columnName), columnName)); index++; } return builder.build(); }
Example #6
Source File: PrimaryKeyListVisitor.java From tx-lcn with Apache License 2.0 | 4 votes |
@Override public void visit(ExpressionList expressionList) { primaryKeyValuesList = new ArrayList<>(); primaryKeyValuesList.add(newKeyValues(expressionList.getExpressions())); }
Example #7
Source File: ObjPD.java From openprodoc with GNU Affero General Public License v3.0 | 4 votes |
private Conditions EvalExpr(Expression ParentExpr ) throws PDException { Conditions New = new Conditions(); int ExprType= EvalExprType(ParentExpr); //System.out.println("ParentExpr=["+ParentExpr+"] Type="+ExprType); switch (ExprType) { case EXPR_BASIC: ComparisonOperator CO = (ComparisonOperator) ParentExpr; String Left=CO.getLeftExpression().toString(); String Comp=CO.getStringExpression(); String Right=CO.getRightExpression().toString(); if (isField(Left) && isField(Right)) New.addCondition(new Condition(Left, Right)); else { String FieldName; Object Value; int TypeVal; if (isField(Left)) { FieldName=Left; Value=CalcVal(Right); TypeVal=CalcTypeVal(Right); } else { FieldName=Right; Value=CalcVal(Left); TypeVal=CalcTypeVal(Left); } // System.out.println("Value="+Value+" class="+Value.getClass().getName()); New.addCondition(new Condition(FieldName, getCompConv().get(Comp), Value, TypeVal)); } break; case EXPR_NOT: Conditions Cs=EvalExpr(((NotExpression) ParentExpr).getExpression()); Cs.setInvert(true); New.addCondition(Cs); break; case EXPR_AND: New.addCondition(EvalExpr(((AndExpression) ParentExpr).getLeftExpression() )); New.addCondition(EvalExpr(((AndExpression) ParentExpr).getRightExpression() )); break; case EXPR_OR: New.addCondition(EvalExpr(((OrExpression) ParentExpr).getLeftExpression() )); New.addCondition(EvalExpr(((OrExpression) ParentExpr).getRightExpression() )); New.setOperatorAnd(false); break; case EXPR_PAR: New.addCondition(EvalExpr(((Parenthesis) ParentExpr).getExpression() )); break; case EXPR_IN: String FieldNameIn=((InExpression)ParentExpr).getLeftExpression().toString(); HashSet<String> ListTerms = new HashSet<String>(); List<Expression> LT =((ExpressionList)((InExpression)ParentExpr).getLeftItemsList()).getExpressions(); for (Iterator<Expression> iterator = LT.iterator(); iterator.hasNext();) { StringValue NextTerm = (StringValue)iterator.next(); ListTerms.add(NextTerm.getValue()); } New.addCondition(new Condition(FieldNameIn,ListTerms)); break; case EXPR_FUNCT: String Arg=((Function)ParentExpr).getParameters().getExpressions().get(0).toString(); switch (((Function)ParentExpr).getName()) { case Condition.CONTAINS: New.addCondition(Condition.genContainsCond(PDDocs.getTableName(),Arg, getDrv())); break; case Condition.INTREE: New.addCondition(Condition.genInTreeCond( Arg, getDrv())); break; case Condition.INFOLDER: New.addCondition(Condition.genInFolder(Arg, getDrv())); break; } break; } return(New); }