RowSetNavigatorData.java (hsqldb-2.6.0) | : | RowSetNavigatorData.java (hsqldb-2.6.1) | ||
---|---|---|---|---|
skipping to change at line 55 | skipping to change at line 55 | |||
import org.hsqldb.lib.ArrayUtil; | import org.hsqldb.lib.ArrayUtil; | |||
import org.hsqldb.lib.LongKeyHashMap; | import org.hsqldb.lib.LongKeyHashMap; | |||
import org.hsqldb.result.ResultMetaData; | import org.hsqldb.result.ResultMetaData; | |||
import org.hsqldb.rowio.RowInputInterface; | import org.hsqldb.rowio.RowInputInterface; | |||
import org.hsqldb.rowio.RowOutputInterface; | import org.hsqldb.rowio.RowOutputInterface; | |||
/** | /** | |||
* Implementation of RowSetNavigator for result sets. | * Implementation of RowSetNavigator for result sets. | |||
* | * | |||
* @author Fred Toussi (fredt@users dot sourceforge.net) | * @author Fred Toussi (fredt@users dot sourceforge.net) | |||
* @version 2.6.0 | * @version 2.6.1 | |||
* @since 1.9.0 | * @since 1.9.0 | |||
*/ | */ | |||
public class RowSetNavigatorData extends RowSetNavigator | public class RowSetNavigatorData extends RowSetNavigator | |||
implements Comparator<Object[]> { | implements Comparator<Object[]> { | |||
public static final Object[][] emptyTable = new Object[0][]; | public static final Object[][] emptyTable = new Object[0][]; | |||
// | // | |||
private Object[][] dataTable = emptyTable; | private Object[][] dataTable = emptyTable; | |||
skipping to change at line 83 | skipping to change at line 83 | |||
boolean reindexTable; | boolean reindexTable; | |||
// | // | |||
Index mainIndex; | Index mainIndex; | |||
Index fullIndex; | Index fullIndex; | |||
Index orderIndex; | Index orderIndex; | |||
Index groupIndex; | Index groupIndex; | |||
Index idIndex; | Index idIndex; | |||
// | // | |||
final SortAndSlice sortAndSlice; | ||||
// | ||||
TreeMap<Object[], Integer> groupMap; | TreeMap<Object[], Integer> groupMap; | |||
LongKeyHashMap idMap; | LongKeyHashMap idMap; | |||
RowSetNavigatorData(Session session) { | RowSetNavigatorData(Session session, SortAndSlice sortAndSlice) { | |||
this.session = session; | this.session = session; | |||
this.sortAndSlice = sortAndSlice; | ||||
} | } | |||
public RowSetNavigatorData(Session session, QuerySpecification select) { | public RowSetNavigatorData(Session session, QuerySpecification select) { | |||
this.session = session; | this.session = session; | |||
this.rangePosition = select.resultRangePosition; | this.rangePosition = select.resultRangePosition; | |||
visibleColumnCount = select.getColumnCount(); | visibleColumnCount = select.getColumnCount(); | |||
isSimpleAggregate = select.isAggregated && !select.isGrouped; | isSimpleAggregate = select.isAggregated && !select.isGrouped; | |||
mainIndex = select.mainIndex; | mainIndex = select.mainIndex; | |||
fullIndex = select.fullIndex; | fullIndex = select.fullIndex; | |||
orderIndex = select.orderIndex; | orderIndex = select.orderIndex; | |||
sortAndSlice = select.sortAndSlice; | ||||
if (select.isGrouped) { | if (select.isGrouped) { | |||
mainIndex = select.groupIndex; | mainIndex = select.groupIndex; | |||
groupMap = new TreeMap<Object[], Integer>(this); | groupMap = new TreeMap<Object[], Integer>(this); | |||
} | } | |||
if (select.idIndex != null) { | if (select.idIndex != null) { | |||
idMap = new LongKeyHashMap(); | idMap = new LongKeyHashMap(); | |||
} | } | |||
} | } | |||
public RowSetNavigatorData(Session session, | public RowSetNavigatorData(Session session, | |||
QueryExpression queryExpression) { | QueryExpression queryExpression) { | |||
this.session = session; | this.session = session; | |||
mainIndex = queryExpression.mainIndex; | mainIndex = queryExpression.mainIndex; | |||
fullIndex = queryExpression.fullIndex; | fullIndex = queryExpression.fullIndex; | |||
orderIndex = queryExpression.orderIndex; | orderIndex = queryExpression.orderIndex; | |||
visibleColumnCount = queryExpression.getColumnCount(); | visibleColumnCount = queryExpression.getColumnCount(); | |||
sortAndSlice = queryExpression.sortAndSlice; | ||||
} | } | |||
public RowSetNavigatorData(Session session, RowSetNavigator navigator) { | public RowSetNavigatorData(Session session, RowSetNavigator navigator) { | |||
this.session = session; | this.session = session; | |||
sortAndSlice = SortAndSlice.noSort; | ||||
setCapacity(navigator.size); | setCapacity(navigator.size); | |||
while (navigator.next()) { | while (navigator.next()) { | |||
add(navigator.getCurrent()); | add(navigator.getCurrent()); | |||
} | } | |||
} | } | |||
public void sortFull() { | public void sortFull() { | |||
skipping to change at line 209 | skipping to change at line 216 | |||
} | } | |||
void addAdjusted(Object[] data, int[] columnMap) { | void addAdjusted(Object[] data, int[] columnMap) { | |||
data = projectData(data, columnMap); | data = projectData(data, columnMap); | |||
add(data); | add(data); | |||
} | } | |||
void insertAdjusted(Object[] data, int[] columnMap) { | void insertAdjusted(Object[] data, int[] columnMap) { | |||
projectData(data, columnMap); | data = projectData(data, columnMap); | |||
insert(data); | insert(data); | |||
} | } | |||
Object[] projectData(Object[] data, int[] columnMap) { | Object[] projectData(Object[] data, int[] columnMap) { | |||
if (columnMap == null) { | if (columnMap == null) { | |||
data = (Object[]) ArrayUtil.resizeArrayIfDifferent(data, | data = (Object[]) ArrayUtil.resizeArrayIfDifferent(data, | |||
visibleColumnCount); | visibleColumnCount); | |||
} else { | } else { | |||
Object[] newData = new Object[visibleColumnCount]; | Object[] newData = new Object[visibleColumnCount]; | |||
End of changes. 8 change blocks. | ||||
3 lines changed or deleted | 10 lines changed or added |