Search in sources :

Example 1 with DMLWriteResultSet

use of org.apache.derby.impl.sql.execute.DMLWriteResultSet in project derby by apache.

the class SQLBoolean method throwExceptionIfImmediateAndFalse.

public BooleanDataValue throwExceptionIfImmediateAndFalse(String sqlState, String tableName, String constraintName, Activation a, int savedUUIDIdx) throws StandardException {
    if (!isNull() && (value == false)) {
        final ExecPreparedStatement ps = a.getPreparedStatement();
        final UUID constrId = (UUID) ps.getSavedObject(savedUUIDIdx);
        final LanguageConnectionContext lcc = a.getLanguageConnectionContext();
        final boolean isDeferred = lcc.isEffectivelyDeferred(lcc.getCurrentSQLSessionContext(a), constrId);
        if (!isDeferred) {
            throw StandardException.newException(sqlState, tableName, constraintName);
        } else {
            // Just return the false value and validate later,
            // cf NoRowsResultSetImpl#evaluateCheckConstraints.
            // and InsertResultSet#evaluateCheckConstraints
            DMLWriteResultSet rs = (DMLWriteResultSet) a.getResultSet();
            rs.rememberConstraint(constrId);
        }
    }
    return this;
}
Also used : ExecPreparedStatement(org.apache.derby.iapi.sql.execute.ExecPreparedStatement) LanguageConnectionContext(org.apache.derby.iapi.sql.conn.LanguageConnectionContext) DMLWriteResultSet(org.apache.derby.impl.sql.execute.DMLWriteResultSet) UUID(org.apache.derby.catalog.UUID)

Aggregations

UUID (org.apache.derby.catalog.UUID)1 LanguageConnectionContext (org.apache.derby.iapi.sql.conn.LanguageConnectionContext)1 ExecPreparedStatement (org.apache.derby.iapi.sql.execute.ExecPreparedStatement)1 DMLWriteResultSet (org.apache.derby.impl.sql.execute.DMLWriteResultSet)1