openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r612583 - in /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel: ExpressionStoreQuery.java jpql/JPQLExpressionBuilder.java
Date Wed, 16 Jan 2008 22:01:44 GMT
Author: ppoddar
Date: Wed Jan 16 14:01:42 2008
New Revision: 612583

URL: http://svn.apache.org/viewvc?rev=612583&view=rev
Log:
OPENJPA-495 Populate Ordering/ProjectClauses from JPQL parser to be used for merging multiple
ordered results

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java?rev=612583&r1=612582&r2=612583&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java
Wed Jan 16 14:01:42 2008
@@ -722,6 +722,8 @@
                     _inMemOrdering = _parser.eval(_exps[0].orderingClauses,
                         (ExpressionStoreQuery) q, factory, _meta);
                 }
+                if (_inMemOrdering == null)
+                    _inMemOrdering = _exps[0].ordering;
             }
 
             // use the parsed ordering expression to extract the ordering value

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java?rev=612583&r1=612582&r2=612583&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
Wed Jan 16 14:01:42 2008
@@ -319,6 +319,7 @@
             JPQLNode node = onlyChild(parent);
             Value proj = getValue(node);
             exps.projections[i] = proj;
+            exps.projectionClauses[i] = assemble(node);
             exps.projectionAliases[i] = nextAlias();
         }
         return exp;
@@ -370,10 +371,12 @@
         if (orderby != null) {
             int ordercount = orderby.getChildCount();
             exps.ordering = new Value[ordercount];
+            exps.orderingClauses = new String[ordercount];
             exps.ascending = new boolean[ordercount];
             for (int i = 0; i < ordercount; i++) {
                 JPQLNode node = orderby.getChild(i);
                 exps.ordering[i] = getValue(firstChild(node));
+                exps.orderingClauses[i] = assemble(firstChild(node));
                 // ommission of ASC/DESC token implies ascending
                 exps.ascending[i] = node.getChildCount() <= 1 ||
                     lastChild(node).id == JJTASCENDING ? true : false;
@@ -1374,7 +1377,7 @@
     private Value getValue(JPQLNode node, int handleVar) {
         Value val = (Value) eval(node);
 
-        // determind how to evauate a variabe
+        // determined how to evaluate a variable
         if (!val.isVariable())
             return val;
         else if (handleVar == VAR_PATH && !(val instanceof Path))



Mime
View raw message