Search in sources :

Example 1 with StatementPlan

use of org.apache.phoenix.compile.StatementPlan in project phoenix by apache.

the class PhoenixPreparedStatement method getParameterMetaData.

@Override
public ParameterMetaData getParameterMetaData() throws SQLException {
    int paramCount = statement.getBindCount();
    List<Object> params = this.getParameters();
    BitSet unsetParams = new BitSet(statement.getBindCount());
    for (int i = 0; i < paramCount; i++) {
        if (params.get(i) == BindManager.UNBOUND_PARAMETER) {
            unsetParams.set(i);
            params.set(i, null);
        }
    }
    try {
        StatementPlan plan = statement.compilePlan(this, Sequence.ValueOp.VALIDATE_SEQUENCE);
        return plan.getParameterMetaData();
    } finally {
        int lastSetBit = 0;
        while ((lastSetBit = unsetParams.nextSetBit(lastSetBit)) != -1) {
            params.set(lastSetBit, BindManager.UNBOUND_PARAMETER);
            lastSetBit++;
        }
    }
}
Also used : StatementPlan(org.apache.phoenix.compile.StatementPlan) BitSet(java.util.BitSet)

Aggregations

BitSet (java.util.BitSet)1 StatementPlan (org.apache.phoenix.compile.StatementPlan)1