@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); } }
private final void bindInsert(BindContext context) { context.visit(getInto()).visit(insertMaps).visit(updateMap); bindReturning(context); }
@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); } }
@Override public final void bind(BindContext context) throws DataAccessException { context.visit(pivot(context.configuration())); }