use of org.hsqldb_voltpatches.navigator.RowSetNavigatorLinkedList in project voltdb by VoltDB.
the class StatementDML method executeDeleteStatement.
// fredt - currently deletes that fail due to referential constraints are caught
// prior to actual delete operation
/**
* Executes a DELETE statement. It is assumed that the argument is
* of the correct type.
*
* @return the result of executing the statement
*/
Result executeDeleteStatement(Session session) {
int count = 0;
RowSetNavigatorLinkedList oldRows = new RowSetNavigatorLinkedList();
RangeIterator it = RangeVariable.getIterator(session, targetRangeVariables);
while (it.next()) {
Row currentRow = it.getCurrentRow();
oldRows.add(currentRow);
}
count = delete(session, baseTable, oldRows);
if (restartIdentity && targetTable.identitySequence != null) {
targetTable.identitySequence.reset();
}
return Result.getUpdateCountResult(count);
}
use of org.hsqldb_voltpatches.navigator.RowSetNavigatorLinkedList in project voltdb by VoltDB.
the class StatementResultUpdate method getResult.
Result getResult(Session session) {
checkAccessRights(session);
Object[] args = session.sessionContext.dynamicArguments;
switch(actionType) {
case ResultConstants.UPDATE_CURSOR:
{
Long id = (Long) args[args.length - 1];
PersistentStore store = session.sessionData.getRowStore(baseTable);
Row row = (Row) store.get((int) id.longValue(), false);
HashMappedList list = new HashMappedList();
Object[] data = (Object[]) ArrayUtil.duplicateArray(row.getData());
for (int i = 0; i < baseColumnMap.length; i++) {
if (types[i] == Type.SQL_ALL_TYPES) {
continue;
}
data[baseColumnMap[i]] = args[i];
}
list.add(row, data);
update(session, baseTable, list);
break;
}
case ResultConstants.DELETE_CURSOR:
{
Long id = (Long) args[args.length - 1];
PersistentStore store = session.sessionData.getRowStore(baseTable);
Row row = (Row) store.get((int) id.longValue(), false);
RowSetNavigator navigator = new RowSetNavigatorLinkedList();
navigator.add(row);
delete(session, baseTable, navigator);
break;
}
case ResultConstants.INSERT_CURSOR:
{
Object[] data = baseTable.getNewRowData(session);
for (int i = 0; i < data.length; i++) {
data[baseColumnMap[i]] = args[i];
}
PersistentStore store = session.sessionData.getRowStore(baseTable);
baseTable.insertRow(session, store, data);
}
}
return Result.updateOneResult;
}
Aggregations