}
boolean insertIndexNodes(Index primaryIndex, Index newIndex) {
int position = newIndex.getPosition();
RowIterator it = primaryIndex.firstRow(this);
int rowCount = 0;
HsqlException error = null;
try {
while (it.hasNext()) {
Row row = it.getNextRow();
((RowAVL) row).insertNode(position);
// count before inserting
rowCount++;
newIndex.insert(null, this, row);
}
return true;
} catch (java.lang.OutOfMemoryError e) {
error = Error.error(ErrorCode.OUT_OF_MEMORY);
} catch (HsqlException e) {
error = e;
}
// backtrack on error
// rowCount rows have been modified
it = primaryIndex.firstRow(this);
for (int i = 0; i < rowCount; i++) {
Row row = it.getNextRow();
NodeAVL backnode = ((RowAVL) row).getNode(0);
int j = position;
while (--j > 0) {
backnode = backnode.nNext;