Row row = null;
PersistentStore store = session.sessionData.getRowStore(this);
if (hasPrimaryKey()) {
RowIterator it = getPrimaryIndex().findFirstRow(session, store,
data, primaryKeyColsSequence);
row = it.getNextRow();
it.release();
} else if (bestIndex == null) {
RowIterator it = rowIterator(session);
while (true) {
row = it.getNextRow();
if (row == null) {
break;
}
if (Table.compareRows(
session, row.getData(), data, defaultColumnMap,
colTypes) == 0) {
break;
}
}
it.release();
} else {
RowIterator it = bestIndex.findFirstRow(session, store, data);
while (true) {
row = it.getNextRow();
if (row == null) {
break;
}
Object[] rowdata = row.getData();
// reached end of range
if (bestIndex.compareRowNonUnique(
session, rowdata, data, bestIndex.getColumns()) != 0) {
row = null;
break;
}
if (Table.compareRows(
session, rowdata, data, defaultColumnMap,
colTypes) == 0) {
break;
}
}
it.release();
}
if (row == null) {
return;
}