Search in sources :

Example 1 with BooleanDataValue

use of org.apache.derby.iapi.types.BooleanDataValue in project derby by apache.

the class UpdateResultSet method foundRow.

public static boolean foundRow(ExecRow checkRow, int[] colsToCheck, TemporaryRowHolderImpl rowHolder) throws StandardException {
    ExecRow scanRow;
    boolean foundMatch = false;
    Object[] checkRowArray = checkRow.getRowArray();
    DataValueDescriptor checkCol;
    DataValueDescriptor scanCol;
    CursorResultSet rs = rowHolder.getResultSet();
    try {
        /*
			** For each inserted row
			*/
        rs.open();
        while ((scanRow = rs.getNextRow()) != null) {
            Object[] scanRowArray = scanRow.getRowArray();
            int i;
            for (i = 0; i < colsToCheck.length; i++) {
                checkCol = (DataValueDescriptor) checkRowArray[colsToCheck[i] - 1];
                scanCol = (DataValueDescriptor) scanRowArray[colsToCheck[i] - 1];
                BooleanDataValue result = checkCol.equals(scanCol, // result
                checkCol);
                if (!result.getBoolean()) {
                    break;
                }
            }
            if (i == colsToCheck.length) {
                foundMatch = true;
                break;
            }
        }
    } finally {
        rs.close();
    }
    return foundMatch;
}
Also used : BooleanDataValue(org.apache.derby.iapi.types.BooleanDataValue) CursorResultSet(org.apache.derby.iapi.sql.execute.CursorResultSet) ExecRow(org.apache.derby.iapi.sql.execute.ExecRow) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor)

Aggregations

CursorResultSet (org.apache.derby.iapi.sql.execute.CursorResultSet)1 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)1 BooleanDataValue (org.apache.derby.iapi.types.BooleanDataValue)1 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)1