Search in sources :

Example 1 with InParameterPlaceholder

use of org.davidmoten.rx.jdbc.callable.internal.InParameterPlaceholder in project rxjava2-jdbc by davidmoten.

the class Call method setParameters.

static PreparedStatement setParameters(PreparedStatement ps, List<Object> parameters, List<ParameterPlaceholder> parameterPlaceholders, List<String> names) throws SQLException {
    // TODO handle Parameter objects (named)
    if (names.isEmpty()) {
        int i = 0;
        for (int j = 0; j < parameterPlaceholders.size() && i < parameters.size(); j++) {
            ParameterPlaceholder p = parameterPlaceholders.get(j);
            if (p instanceof InParameterPlaceholder) {
                Util.setParameter(ps, j + 1, parameters.get(i));
                i++;
            }
        }
    } else {
        // TODO
        throw new RuntimeException("named paramters not implemented yet for CallableStatement yet");
    // Util.setNamedParameters(ps, params, names);
    }
    return ps;
}
Also used : InParameterPlaceholder(org.davidmoten.rx.jdbc.callable.internal.InParameterPlaceholder) OutParameterPlaceholder(org.davidmoten.rx.jdbc.callable.internal.OutParameterPlaceholder) ParameterPlaceholder(org.davidmoten.rx.jdbc.callable.internal.ParameterPlaceholder) InParameterPlaceholder(org.davidmoten.rx.jdbc.callable.internal.InParameterPlaceholder)

Aggregations

InParameterPlaceholder (org.davidmoten.rx.jdbc.callable.internal.InParameterPlaceholder)1 OutParameterPlaceholder (org.davidmoten.rx.jdbc.callable.internal.OutParameterPlaceholder)1 ParameterPlaceholder (org.davidmoten.rx.jdbc.callable.internal.ParameterPlaceholder)1