ParserDQL.java (hsqldb-2.6.0) | : | ParserDQL.java (hsqldb-2.6.1) | ||
---|---|---|---|---|
skipping to change at line 68 | skipping to change at line 68 | |||
import org.hsqldb.types.IntervalType; | import org.hsqldb.types.IntervalType; | |||
import org.hsqldb.types.NumberType; | import org.hsqldb.types.NumberType; | |||
import org.hsqldb.types.Type; | import org.hsqldb.types.Type; | |||
import org.hsqldb.types.Types; | import org.hsqldb.types.Types; | |||
import org.hsqldb.types.UserTypeModifier; | import org.hsqldb.types.UserTypeModifier; | |||
/** | /** | |||
* Parser for DQL statements | * Parser for DQL statements | |||
* | * | |||
* @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 ParserDQL extends ParserBase { | public class ParserDQL extends ParserBase { | |||
protected Database database; | protected Database database; | |||
protected Session session; | protected Session session; | |||
protected final CompileContext compileContext; | protected final CompileContext compileContext; | |||
/** | /** | |||
* Constructs a new Parser object with the given context. | * Constructs a new Parser object with the given context. | |||
skipping to change at line 1909 | skipping to change at line 1909 | |||
e1 = e2; | e1 = e2; | |||
e2 = XreadSimpleValueSpecificationOrNull(); | e2 = XreadSimpleValueSpecificationOrNull(); | |||
} else if (token.tokenType == Tokens.OFFSET) { | } else if (token.tokenType == Tokens.OFFSET) { | |||
read(); | read(); | |||
e1 = XreadSimpleValueSpecificationOrNull(); | e1 = XreadSimpleValueSpecificationOrNull(); | |||
} | } | |||
} | } | |||
if (database.sqlSyntaxPgs || database.sqlSyntaxMys) { | if (database.sqlSyntaxPgs || database.sqlSyntaxMys) { | |||
sortAndSlice.setZeroLimit(); | sortAndSlice.setZeroLimitIsZero(); | |||
} | } | |||
} else if (token.tokenType == Tokens.FETCH) { | } else if (token.tokenType == Tokens.FETCH) { | |||
read(); | read(); | |||
if (token.tokenType == Tokens.FIRST | if (token.tokenType == Tokens.FIRST | |||
|| token.tokenType == Tokens.NEXT) { | || token.tokenType == Tokens.NEXT) { | |||
read(); | read(); | |||
} | } | |||
e2 = XreadSimpleValueSpecificationOrNull(); | e2 = XreadSimpleValueSpecificationOrNull(); | |||
skipping to change at line 3549 | skipping to change at line 3549 | |||
return e; | return e; | |||
} | } | |||
} | } | |||
private void checkIfGroupingOrAggregate(Expression e) { | private void checkIfGroupingOrAggregate(Expression e) { | |||
if (e == null) { | if (e == null) { | |||
return; | return; | |||
} | } | |||
if (OpTypes.subqueryAggregateExpressionSet.contains(e.opType)) { | if (OpTypes.GROUPING == e.opType | |||
|| OpTypes.subqueryAggregateExpressionSet.contains(e.opType)) { | ||||
throw Error.error( | throw Error.error( | |||
ErrorCode.X_42572, | ErrorCode.X_42572, | |||
"aggregate functions / subqueries are not allowed in GROUP BY"); | "aggregate functions / subqueries are not allowed in GROUP BY"); | |||
} | } | |||
for (int i = 0; i < e.nodes.length; i++) { | for (int i = 0; i < e.nodes.length; i++) { | |||
checkIfGroupingOrAggregate(e.nodes[i]); | checkIfGroupingOrAggregate(e.nodes[i]); | |||
} | } | |||
} | } | |||
skipping to change at line 3783 | skipping to change at line 3784 | |||
return XreadCharacterValueExpression(); | return XreadCharacterValueExpression(); | |||
// XreadBinaryValueExpression(); | // XreadBinaryValueExpression(); | |||
} | } | |||
Expression XreadCharacterValueExpression() { | Expression XreadCharacterValueExpression() { | |||
Expression e = XreadCharacterPrimary(); | Expression e = XreadCharacterPrimary(); | |||
Collation collation = readCollateClauseOrNull(); | Collation collation = readCollateClauseOrNull(); | |||
while (token.tokenType == Tokens.CONCAT_OP) { | while (token.tokenType == Tokens.CONCAT_OP | |||
|| token.tokenType == Tokens.PLUS_OP) { | ||||
read(); | read(); | |||
Expression a = e; | Expression a = e; | |||
e = XreadCharacterPrimary(); | e = XreadCharacterPrimary(); | |||
collation = readCollateClauseOrNull(); | collation = readCollateClauseOrNull(); | |||
e = new ExpressionArithmetic(OpTypes.CONCAT, a, e); | e = new ExpressionArithmetic(OpTypes.CONCAT, a, e); | |||
} | } | |||
return e; | return e; | |||
skipping to change at line 7309 | skipping to change at line 7311 | |||
readThis(Tokens.LOCKS); | readThis(Tokens.LOCKS); | |||
} | } | |||
} | } | |||
if (ResultProperties.isUpdatable(props)) { | if (ResultProperties.isUpdatable(props)) { | |||
queryExpression.isUpdatable = true; | queryExpression.isUpdatable = true; | |||
} | } | |||
queryExpression.setReturningResult(); | queryExpression.setReturningResult(); | |||
if (database.sqlLowerCaseIdentifier && !isRoutine ) { | ||||
queryExpression.setLowerCaseResultIdentifer(); | ||||
} | ||||
queryExpression.resolve(session, rangeGroups, null); | queryExpression.resolve(session, rangeGroups, null); | |||
StatementQuery cs = isRoutine | StatementQuery cs = isRoutine | |||
? new StatementCursor(session, queryExpression, | ? new StatementCursor(session, queryExpression, | |||
compileContext) | compileContext) | |||
: new StatementQuery(session, queryExpression, | : new StatementQuery(session, queryExpression, | |||
compileContext); | compileContext); | |||
return cs; | return cs; | |||
} | } | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 10 lines changed or added |