Search in sources :

Example 1 with OutParameterPlaceholder

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

the class Call method execute.

private static List<PlaceAndType> execute(NamedCallableStatement stmt, List<Object> parameters, List<ParameterPlaceholder> parameterPlaceholders, int outCount, CallableStatement st) throws SQLException {
    Util.incrementCounter(st.getConnection());
    setParameters(st, parameters, parameterPlaceholders, stmt.names);
    int initialSize = outCount == Integer.MAX_VALUE ? 16 : outCount;
    List<PlaceAndType> outs = new ArrayList<PlaceAndType>(initialSize);
    for (int j = 0; j < parameterPlaceholders.size(); j++) {
        ParameterPlaceholder p = parameterPlaceholders.get(j);
        if (p instanceof OutParameterPlaceholder) {
            outs.add(new PlaceAndType(j + 1, ((OutParameterPlaceholder) p).type()));
            if (outs.size() == outCount) {
                break;
            }
        }
    }
    st.execute();
    return outs;
}
Also used : OutParameterPlaceholder(org.davidmoten.rx.jdbc.callable.internal.OutParameterPlaceholder) ArrayList(java.util.ArrayList) 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

ArrayList (java.util.ArrayList)1 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