Search in sources :

Example 1 with Builder

use of io.github.tramchamploo.bufferslayer.Sql.Builder in project buffer-slayer by tramchamploo.

the class BatchJdbcTemplate method update.

public MessageFuture<Integer> update(PreparedStatementCreator psc) throws DataAccessException {
    if (psc instanceof SqlProvider) {
        SqlProvider sqlProvider = (SqlProvider) psc;
        String sql = sqlProvider.getSql();
        Builder builder = Sql.builder().sql(sql);
        if (psc instanceof PreparedStatementSetter) {
            PreparedStatementSetter pss = (PreparedStatementSetter) psc;
            builder.preparedStatementSetter(pss);
        }
        return reporter.report(builder.build());
    }
    throw new UnsupportedOperationException("Must be instance of SqlProvider");
}
Also used : SqlProvider(org.springframework.jdbc.core.SqlProvider) Builder(io.github.tramchamploo.bufferslayer.Sql.Builder) BatchPreparedStatementSetter(org.springframework.jdbc.core.BatchPreparedStatementSetter) PreparedStatementSetter(org.springframework.jdbc.core.PreparedStatementSetter) ParameterizedPreparedStatementSetter(org.springframework.jdbc.core.ParameterizedPreparedStatementSetter)

Aggregations

Builder (io.github.tramchamploo.bufferslayer.Sql.Builder)1 BatchPreparedStatementSetter (org.springframework.jdbc.core.BatchPreparedStatementSetter)1 ParameterizedPreparedStatementSetter (org.springframework.jdbc.core.ParameterizedPreparedStatementSetter)1 PreparedStatementSetter (org.springframework.jdbc.core.PreparedStatementSetter)1 SqlProvider (org.springframework.jdbc.core.SqlProvider)1