use of org.hsqldb_voltpatches.persist.PersistentStore in project voltdb by VoltDB.
the class Constraint method checkHasMainRef.
/**
* For the candidate table row, finds any referring node in the main table.
* This is used to check referential integrity when updating a node. We
* have to make sure that the main table still holds a valid main record.
* returns true If a valid row is found, false if there are null in the data
* Otherwise a 'INTEGRITY VIOLATION' Exception gets thrown.
*/
boolean checkHasMainRef(Session session, Object[] row) {
if (ArrayUtil.hasNull(row, core.refCols)) {
return false;
}
PersistentStore store = session.sessionData.getRowStore(core.mainTable);
boolean exists = core.mainIndex.exists(session, store, row, core.refCols);
if (!exists) {
String[] info = new String[] { core.refName.name, core.mainTable.getName().name };
throw Error.error(ErrorCode.X_23502, ErrorCode.CONSTRAINT, info);
}
return exists;
}
use of org.hsqldb_voltpatches.persist.PersistentStore in project voltdb by VoltDB.
the class TextTable method getHeader.
public String getHeader() {
PersistentStore store = database.persistentStoreCollection.getStore(this);
TextCache cache = (TextCache) store.getCache();
String header = cache == null ? null : cache.getHeader();
return header == null ? null : StringConverter.toQuotedString(header, '\"', true);
}
use of org.hsqldb_voltpatches.persist.PersistentStore in project voltdb by VoltDB.
the class TransactionManager method mergeRolledBackTransaction.
/**
* merge a given list of transaction rollback action with given timestamp
*/
void mergeRolledBackTransaction(Object[] list, int start, int limit) {
for (int i = start; i < limit; i++) {
RowAction rowact = (RowAction) list[i];
if (rowact == null || rowact.type == RowActionBase.ACTION_NONE || rowact.type == RowActionBase.ACTION_DELETE_FINAL) {
continue;
}
Row row = rowact.memoryRow;
if (row == null) {
PersistentStore store = rowact.session.sessionData.getRowStore(rowact.table);
row = (Row) store.get(rowact.getPos(), false);
}
if (row == null) {
continue;
}
synchronized (row) {
rowact.mergeRollback(row);
}
}
// } catch (Throwable t) {
// System.out.println("throw in merge");
// t.printStackTrace();
// }
}
use of org.hsqldb_voltpatches.persist.PersistentStore in project voltdb by VoltDB.
the class Table method deleteNoCheckFromLog.
/**
* For log statements. Delete a single row.
*/
public void deleteNoCheckFromLog(Session session, Object[] data) {
Row row = null;
PersistentStore store = session.sessionData.getRowStore(this);
if (hasPrimaryKey()) {
RowIterator it = getPrimaryIndex().findFirstRow(session, store, data, primaryKeyColsSequence);
row = it.getNextRow();
} else if (bestIndex == null) {
RowIterator it = rowIterator(session);
while (true) {
row = it.getNextRow();
if (row == null) {
break;
}
if (IndexAVL.compareRows(row.getData(), data, defaultColumnMap, colTypes) == 0) {
break;
}
}
} 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(data, bestIndex.getColumns(), rowdata) != 0) {
row = null;
break;
}
if (IndexAVL.compareRows(rowdata, data, defaultColumnMap, colTypes) == 0) {
break;
}
}
}
if (row == null) {
return;
}
deleteNoCheck(session, row);
}
use of org.hsqldb_voltpatches.persist.PersistentStore in project voltdb by VoltDB.
the class Table method getIndexRootsArray.
/**
* Return the list of file pointers to root nodes for this table's
* indexes.
*/
public final int[] getIndexRootsArray() {
PersistentStore store = database.persistentStoreCollection.getStore(this);
int[] roots = new int[getIndexCount()];
for (int i = 0; i < getIndexCount(); i++) {
CachedObject accessor = store.getAccessor(indexList[i]);
roots[i] = accessor == null ? -1 : accessor.getPos();
}
return roots;
}
Aggregations