"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "hsqldb/src/org/hsqldb/SortAndSlice.java" between
hsqldb-2.6.0.zip and hsqldb-2.6.1.zip

About: HSQLDB (HyperSQL DataBase) is a SQL relational database engine written in Java. It supports nearly full ANSI-92 SQL (BNF format) and full core SQL:2008.

SortAndSlice.java  (hsqldb-2.6.0):SortAndSlice.java  (hsqldb-2.6.1)
skipping to change at line 45 skipping to change at line 45
import org.hsqldb.index.Index; import org.hsqldb.index.Index;
import org.hsqldb.lib.ArrayUtil; import org.hsqldb.lib.ArrayUtil;
import org.hsqldb.lib.HsqlArrayList; import org.hsqldb.lib.HsqlArrayList;
import org.hsqldb.types.Collation; import org.hsqldb.types.Collation;
import org.hsqldb.types.Type; import org.hsqldb.types.Type;
/* /*
* Implementation of ORDER BY and LIMIT properties of query expressions. * Implementation of ORDER BY and LIMIT properties of query expressions.
* *
* @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 final class SortAndSlice { public final class SortAndSlice {
static final SortAndSlice noSort = new SortAndSlice(); public static final SortAndSlice noSort = new SortAndSlice();
static final int[] defaultLimits = new int[] { static final int[] defaultLimits = new int[] {
0, Integer.MAX_VALUE, Integer.MAX_VALUE 0, Integer.MAX_VALUE, Integer.MAX_VALUE
}; };
// //
public int[] sortOrder; public int[] sortOrder;
public boolean[] sortDescending; public boolean[] sortDescending;
public boolean[] sortNullsLast; public boolean[] sortNullsLast;
public Collation[] collations; public Collation[] collations;
boolean hasCollation; boolean hasCollation;
boolean sortUnion; boolean sortUnion;
HsqlArrayList exprList = new HsqlArrayList(); HsqlArrayList exprList = new HsqlArrayList();
ExpressionOp limitCondition; ExpressionOp limitCondition;
public int columnCount; public int columnCount;
boolean hasNullsLast; boolean hasNullsLast;
boolean strictLimit; boolean noZeroLimit;
boolean zeroLimit; boolean zeroLimitIsZero;
boolean usingIndex; boolean usingIndex;
boolean descendingSort; boolean descendingSort;
public boolean skipSort = false; // true when result can be use d as is public boolean skipSort = false; // true when result can be use d as is
public boolean skipFullResult = false; // true when result can be sli ced as is public boolean skipFullResult = false; // true when result can be sli ced as is
public Index index; public Index index;
public Table primaryTable; public Table primaryTable;
public Index primaryTableIndex; public Index primaryTableIndex;
public int[] colIndexes; public int[] colIndexes;
public boolean isGenerated; public boolean isGenerated;
skipping to change at line 105 skipping to change at line 105
public void addOrderExpression(Expression e) { public void addOrderExpression(Expression e) {
exprList.add(e); exprList.add(e);
} }
public void addLimitCondition(ExpressionOp expression) { public void addLimitCondition(ExpressionOp expression) {
limitCondition = expression; limitCondition = expression;
} }
public void setStrictLimit() { public void setStrictLimit() {
strictLimit = true; noZeroLimit = true;
} }
public void setZeroLimit() { public void setZeroLimitIsZero() {
zeroLimit = true; zeroLimitIsZero = true;
} }
public void setUsingIndex() { public void setUsingIndex() {
usingIndex = true; usingIndex = true;
} }
public void prepareSingleColumn(int colIndex) { public void prepareSingleColumn(int colIndex) {
sortOrder = new int[1]; sortOrder = new int[1];
sortDescending = new boolean[1]; sortDescending = new boolean[1];
skipping to change at line 419 skipping to change at line 419
} }
skipRows = value.intValue(); skipRows = value.intValue();
hasLimits = skipRows != 0; hasLimits = skipRows != 0;
if (limitCondition.getRightNode() != null) { if (limitCondition.getRightNode() != null) {
value = value =
(Integer) limitCondition.getRightNode().getValue(session); (Integer) limitCondition.getRightNode().getValue(session);
if (value == null || value.intValue() < 0 if (value == null || value.intValue() < 0
|| (strictLimit && value.intValue() == 0)) { || (noZeroLimit && value.intValue() == 0)) {
throw Error.error(ErrorCode.X_2201W); throw Error.error(ErrorCode.X_2201W);
} }
if (value.intValue() == 0 && !zeroLimit) { if (value.intValue() == 0 && !zeroLimitIsZero) {
limitRows = Integer.MAX_VALUE; limitRows = Integer.MAX_VALUE;
} else { } else {
limitRows = value.intValue(); limitRows = value.intValue();
hasLimits = true; hasLimits = true;
} }
} }
} }
if (maxRows != 0) { if (maxRows != 0) {
if (maxRows < limitRows) { if (maxRows < limitRows) {
 End of changes. 7 change blocks. 
10 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)