@Override public final void bind(BindContext context) { if (context.declareFields() || context.declareTables()) { context.visit(wrapped); } else { // Don't bind any values } }
@Override public final void bind(BindContext context) { // If this is already a subquery, proceed if (context.subquery()) { context.visit(query); } else { context.subquery(true).visit(query).subquery(false); } }
@Override public final void bind(BindContext context) { if (symmetric && asList(CUBRID, DB2, DERBY, FIREBIRD, H2, MYSQL, ORACLE, SQLSERVER, SQLITE, SYBASE) .contains(context.getDialect())) { simulateSymmetric().bind(context); } else { context.bind(field).bind(minValue).bind(maxValue); } }
final void bindReturning(BindContext context) { switch (context.configuration().dialect()) { case FIREBIRD: case POSTGRES: context.bind((QueryPart) returning); break; default: // Other dialects don't bind a RETURNING clause, but // use JDBC's Statement.RETURN_GENERATED_KEYS mode instead } }
@Override public final void bind(BindContext context) { context .declareFields(true) .bind((QueryPart) getSelect0()) .declareFields(false) .declareTables(true) .bind((QueryPart) getFrom()) .declareTables(false) .bind(getWhere()) .bind(getConnectByStartWith()) .bind(getConnectBy()) .bind((QueryPart) getGroupBy()) .bind(getHaving()) .bind((QueryPart) getOrderBy()); // TOP clauses never bind values. So this can be safely applied at the // end for LIMIT .. OFFSET clauses, or ROW_NUMBER() filtering if (getLimit().isApplicable()) { context.bind(getLimit()); } context.bind((QueryPart) forUpdateOf).bind((QueryPart) forUpdateOfTables); }
@Override public final void bind(BindContext context) { context.bind(getInto()); // A multi-row update was specified if (multiRow != null) { context.bind(multiRow); if (multiValue != null) { context.bind(multiValue); } else { context.subquery(true).bind(multiSelect).subquery(false); } } // A regular (non-multi-row) update was specified else { context.bind(updateMap); } context.bind(condition); bindReturning(context); }
@Override public final void bind(BindContext context) { delegate(context.configuration()).bind(context); }
@Override public final void bind(BindContext context) throws DataAccessException { context.bind(array); }
@Override public final void bind(BindContext context) { context.bind(table(context)); }
private final void bindInsert(BindContext context) { context.visit(getInto()).visit(insertMaps).visit(updateMap); bindReturning(context); }
@Override public void bind(BindContext ctx) throws DataAccessException { ctx.declareTables(true).visit(select(ctx.configuration())).declareTables(false); }
@Override public final void bind(BindContext context) { context.bind(lhs).bind((QueryPart) rhs); }
@Override public final void bind(BindContext context) { context.bind(delegate); }
@Override public final void bind(BindContext context) { switch (context.getDialect()) { // OFFSET .. LIMIT support provided by the following dialects // ---------------------------------------------------------- case MYSQL: case DERBY: { context.bind(val(getOffset())); context.bind(val(getNumberOfRows())); break; } // LIMIT .. OFFSET support provided by the following dialects // ---------------------------------------------------------- case HSQLDB: case H2: case POSTGRES: case SQLITE: { context.bind(val(getNumberOfRows())); context.bind(val(getOffset())); break; } // No bind variables in the TOP .. START AT clause // ----------------------------------------------- case INGRES: case SYBASE: { break; } // These dialects don't allow bind variables in their TOP clauses // -------------------------------------------------------------- case ASE: case DB2: case SQLSERVER: { // TOP clauses without bind variables if (offset == 0) { break; } // With simulated OFFSETs, no break, fall through else { } } // Oracle knows no TOP clause, limits are always bound // Also, with simulated OFFSETs, the previous dialects fall through // ----------------------------------------------------------------- case ORACLE: { context.bind(val(getLowerRownum())); context.bind(val(getUpperRownum())); break; } } }
@Override public final void bind(BindContext context) throws DataAccessException { context.visit(pivot(context.configuration())); }
@Override public final void bind(BindContext context) { context.bind(row).bind(minValue).bind(maxValue); }
@Override public final void bind(BindContext context) { /* [pro] xx xx xxxxxxxxxxxxxxxxxxxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxx x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxx x xxxx xx [/pro] */ // ON DUPLICATE KEY UPDATE clause // ------------------------------ if (onDuplicateKeyUpdate) { switch (context.configuration().dialect().family()) { // MySQL has a nice syntax for this case CUBRID: case MARIADB: case MYSQL: { bindInsert(context); break; } // Some dialects can't really handle this clause. Simulation // is done in two steps case H2: { throw new SQLDialectNotSupportedException( "The ON DUPLICATE KEY UPDATE clause cannot be simulated for " + context.configuration().dialect()); } // Some databases allow for simulating this clause using a // MERGE statement /* [pro] xx xxxx xxxx xxxx xxxxxxx xxxx xxxxxxxxxx xxxx xxxxxxx xx [/pro] */ case HSQLDB: { context.visit(toMerge(context.configuration())); break; } default: throw new SQLDialectNotSupportedException( "The ON DUPLICATE KEY UPDATE clause cannot be simulated for " + context.configuration().dialect()); } } // ON DUPLICATE KEY IGNORE clause // ------------------------------ else if (onDuplicateKeyIgnore) { switch (context.configuration().dialect().family()) { // MySQL has a nice, native syntax for this case MARIADB: case MYSQL: { bindInsert(context); break; } // CUBRID can simulate this using ON DUPLICATE KEY UPDATE case CUBRID: { bindInsert(context); break; } // Some dialects can't really handle this clause. Simulation // is done in two steps case H2: { throw new SQLDialectNotSupportedException( "The ON DUPLICATE KEY IGNORE clause cannot be simulated for " + context.configuration().dialect()); } // Some databases allow for simulating this clause using a // MERGE statement /* [pro] xx xxxx xxxx xxxx xxxxxxx xxxx xxxxxxxxxx xxxx xxxxxxx xx [/pro] */ case HSQLDB: { context.visit(toMerge(context.configuration())); break; } default: throw new SQLDialectNotSupportedException( "The ON DUPLICATE KEY IGNORE clause cannot be simulated for " + context.configuration().dialect()); } } // Default mode // ------------ else { bindInsert(context); } }