// process each AND clause
row_qualifies = false;
// Apply one qualifier to the row.
Qualifier q = qual_list[0][i];
int col_id = q.getColumnId();
if (SanityManager.DEBUG)
{
SanityManager.ASSERT(
(col_id < row.length),
"Qualifier is referencing a column not in the row.");
}
// materialize the column object if we haven't done it yet.
if (materializedCols[col_id] == 0)
{
// materialize just this column from the row, no qualifiers
readOneColumnFromPage(
row,
col_id,
offset_to_row_data,
recordHeader,
recordToLock);
// mark offset, indicating the row has been read in.
//
// RESOLVE (mikem) - right now value of entry is useless, it
// is an int so that in the future we could cache the offset
// to fields to improve performance of getting to a column
// after qualifying.
materializedCols[col_id] = offset_to_row_data;
}
// Get the column from the possibly partial row, of the
// q.getColumnId()'th column in the full row.
if (SanityManager.DEBUG)
{
if (row[col_id] == null)
SanityManager.THROWASSERT(
"1:row = " + RowUtil.toString(row) +
"row.length = " + row.length +
";q.getColumnId() = " + q.getColumnId());
}
// do the compare between the column value and value in the
// qualifier.
row_qualifies =
((DataValueDescriptor) row[col_id]).compare(
q.getOperator(),
q.getOrderable(),
q.getOrderedNulls(),
q.getUnknownRV());
if (q.negateCompareResult())
row_qualifies = !row_qualifies;
// Once an AND fails the whole Qualification fails - do a return!
if (!row_qualifies)
return(false);
}
// Now process the Subsequent OR clause's, beginning with qual_list[1]
for (int and_idx = 1; and_idx < qual_list.length; and_idx++)
{
// loop through each of the "and" clause.
row_qualifies = false;
for (int or_idx = 0; or_idx < qual_list[and_idx].length; or_idx++)
{
// Apply one qualifier to the row.
Qualifier q = qual_list[and_idx][or_idx];
int col_id = q.getColumnId();
if (SanityManager.DEBUG)
{
SanityManager.ASSERT(
(col_id < row.length),
"Qualifier is referencing a column not in the row.");
}
// materialize the column object if we haven't done it yet.
if (materializedCols[col_id] == 0)
{
// materialize just this column from the row, no qualifiers
readOneColumnFromPage(
row,
col_id,
offset_to_row_data,
recordHeader,
recordToLock);
// mark offset, indicating the row has been read in.
//
// RESOLVE (mikem) - right now value of entry is useless, it
// is an int so that in the future we could cache the offset
// to fields to improve performance of getting to a column
// after qualifying.
materializedCols[col_id] = offset_to_row_data;
}
// Get the column from the possibly partial row, of the
// q.getColumnId()'th column in the full row.
if (SanityManager.DEBUG)
{
if (row[col_id] == null)
SanityManager.THROWASSERT(
"1:row = " + RowUtil.toString(row) +
"row.length = " + row.length +
";q.getColumnId() = " + q.getColumnId());
}
// do the compare between the column value and value in the
// qualifier.
row_qualifies =
((DataValueDescriptor) row[col_id]).compare(
q.getOperator(),
q.getOrderable(),
q.getOrderedNulls(),
q.getUnknownRV());
if (q.negateCompareResult())
row_qualifies = !row_qualifies;
// SanityManager.DEBUG_PRINT("StoredPage.qual", "processing qual[" + and_idx + "][" + or_idx + "] = " + qual_list[and_idx][or_idx] );
// SanityManager.DEBUG_PRINT("StoredPage.qual", "value = " + row_qualifies);