/** * Moves the data from an old store to new after changes to table The colindex argument is the * index of the column that was added or removed. The adjust argument is {-1 | 0 | +1} */ public final void moveData(Session session, PersistentStore other, int colindex, int adjust) { Object colvalue = null; Type oldtype = null; Type newtype = null; if (adjust >= 0 && colindex != -1) { ColumnSchema column = ((Table) table).getColumn(colindex); colvalue = column.getDefaultValue(session); if (adjust == 0) { oldtype = ((Table) other.getTable()).getColumnTypes()[colindex]; newtype = ((Table) table).getColumnTypes()[colindex]; } } RowIterator it = other.rowIterator(); Table table = (Table) this.table; try { while (it.hasNext()) { Row row = it.getNextRow(); Object[] o = row.getData(); Object[] data = table.getEmptyRowData(); if (adjust == 0 && colindex != -1) { colvalue = newtype.convertToType(session, o[colindex], oldtype); } ArrayUtil.copyAdjustArray(o, data, colvalue, colindex, adjust); table.systemSetIdentityColumn(session, data); table.enforceTypeLimits(session, data); table.enforceRowConstraints(session, data); // get object without RowAction Row newrow = (Row) getNewCachedObject(null, data); indexRow(null, newrow); } } catch (java.lang.OutOfMemoryError e) { throw Error.error(ErrorCode.OUT_OF_MEMORY); } }