private void deleteIteratedIndexFields(int recordCnt, int testColIx, long keyIncrement,
			int varDataSize) throws IOException {

		DBRecord[] recs = null;
		if (keyIncrement == 0) {
			recs = createRandomTableRecords(DBTestUtils.ALL_TYPES, recordCnt, varDataSize);
		}
		else {
			recs = createOrderedTableRecords(DBTestUtils.ALL_TYPES, recordCnt, keyIncrement,
				varDataSize);
		}
		long txId = dbh.startTransaction();
		try {
			Table table = dbh.getTable(table1Name);

			Arrays.sort(recs, new RecColumnComparator(testColIx));

			// Count unique index values
			int fieldCnt = 0;
			Field lastField = null;
			ArrayList<Field> fieldList = new ArrayList<>();
			for (DBRecord rec : recs) {
				Field f = rec.getField(testColIx);
				if (lastField == null || !lastField.equals(f)) {
					lastField = f;
					fieldList.add(f);
					++fieldCnt;
				}
			}

			//
			// Index Field Iterator does not support variable length fields
			//
			if (lastField.isVariableLength()) {
				return;// skip test
			}

			// Forward - delete all records
			DBFieldIterator iter = table.indexFieldIterator(testColIx);
			int cnt = 0;
			while (iter.hasNext()) {
				assertEquals(fieldList.get(cnt++), iter.next());
				assertTrue(iter.delete());
			}
			assertEquals(fieldCnt, cnt);
			assertEquals(0, table.getRecordCount());
		}
		finally {
			dbh.deleteTable(table1Name);
			dbh.endTransaction(txId, true);
		}

		if (keyIncrement == 0) {
			recs = createRandomTableRecords(DBTestUtils.ALL_TYPES, recordCnt, varDataSize);
		}
		else {
			recs = createOrderedTableRecords(DBTestUtils.ALL_TYPES, recordCnt, keyIncrement,
				varDataSize);
		}
		txId = dbh.startTransaction();

		try {
			Table table = dbh.getTable(table1Name);

			Arrays.sort(recs, new RecColumnComparator(testColIx));

			// Count unique index values
			int fieldCnt = 0;
			Field lastField = null;
			ArrayList<Field> fieldList = new ArrayList<>();
			for (DBRecord rec : recs) {
				Field f = rec.getField(testColIx);
				if (lastField == null || !lastField.equals(f)) {
					lastField = f;
					fieldList.add(f);
					++fieldCnt;
				}
			}

			// Reverse - delete all records

			int cnt = fieldCnt - 1;
			int lastIx = recs.length - 1;
			DBFieldIterator iter = table.indexFieldIterator(recs[0].getField(testColIx),
				recs[lastIx].getField(testColIx), false, testColIx);
			while (iter.hasPrevious()) {
				assertEquals(fieldList.get(cnt--), iter.previous());
				assertTrue(iter.delete());
			}
			assertEquals(-1, cnt);
			assertEquals(0, table.getRecordCount());
		}
		finally {
			dbh.deleteTable(table1Name);
			dbh.endTransaction(txId, true);
		}
	}
Test record iterator.

@param testStoredDB test against a stored database if true, else test against cached database
           only.
@param recordCnt number of records to test
@param keyIncrement key increment, 0 = random
@param varDataSize size of variable length data fields.
@throws IOException
Ghidra/Framework/DB/src/test/java/db/DBFixedKeyIndexedTableTest.java