Search in sources :

Example 1 with FieldValue

use of org.firebirdsql.gds.ng.fields.FieldValue in project jaybird by FirebirdSQL.

the class AbstractPreparedStatement method clearParameters.

/**
 * Clears the current parameter values immediately.
 * <P>
 * In general, parameter values remain in force for repeated use of a
 * statement. Setting a parameter value automatically clears its previous
 * value. However, in some cases it is useful to immediately release the
 * resources used by the current parameter values; this can be done by
 * calling the method <code>clearParameters</code>.
 *
 * @exception SQLException
 *                if a database access error occurs
 */
public void clearParameters() throws SQLException {
    checkValidity();
    if (fieldValues == null)
        return;
    // TODO Remove: should be based on FieldValue#isInitialized
    Arrays.fill(isParamSet, false);
    for (FieldValue fieldValue : fieldValues) {
        fieldValue.reset();
    }
}
Also used : FieldValue(org.firebirdsql.gds.ng.fields.FieldValue)

Example 2 with FieldValue

use of org.firebirdsql.gds.ng.fields.FieldValue in project jaybird by FirebirdSQL.

the class AbstractPreparedStatement method executeSingleForBatch.

private void executeSingleForBatch(RowValue data, List<Long> results) throws SQLException {
    for (int i = 0; i < fieldValues.getCount(); i++) {
        FieldValue fieldValue = fieldValues.getFieldValue(i);
        fieldValue.reset();
        FBField field = getField(i + 1);
        if (field instanceof FBFlushableField) {
            // Explicitly set to null to ensure initialized property set to true
            fieldValue.setFieldData(null);
            ((FBFlushableField) field).setCachedObject((CachedObject) data.getFieldValue(i).getCachedObject());
        } else {
            fieldValue.setFieldData(data.getFieldValue(i).getFieldData());
        }
        isParamSet[i] = true;
    }
    if (internalExecute(isExecuteProcedureStatement)) {
        throw jdbcVersionSupport.createBatchUpdateException("Statements executed as batch should not produce a result set", SQLStateConstants.SQL_STATE_INVALID_STMT_TYPE, 0, toLargeArray(results), null);
    }
    results.add(getLargeUpdateCount());
}
Also used : FBField(org.firebirdsql.jdbc.field.FBField) FBFlushableField(org.firebirdsql.jdbc.field.FBFlushableField) FieldValue(org.firebirdsql.gds.ng.fields.FieldValue)

Aggregations

FieldValue (org.firebirdsql.gds.ng.fields.FieldValue)2 FBField (org.firebirdsql.jdbc.field.FBField)1 FBFlushableField (org.firebirdsql.jdbc.field.FBFlushableField)1