openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From allee8...@apache.org
Subject svn commit: r1309495 - in /openjpa: branches/2.2.x/pom.xml trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java trunk/pom.xml
Date Wed, 04 Apr 2012 17:15:51 GMT
Author: allee8285
Date: Wed Apr  4 17:15:50 2012
New Revision: 1309495

URL: http://svn.apache.org/viewvc?rev=1309495&view=rev
Log:
OPENJPA-2131 - Commit contribution by Zilin Chen.

Modified:
    openjpa/branches/2.2.x/pom.xml
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java
    openjpa/trunk/pom.xml

Modified: openjpa/branches/2.2.x/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/pom.xml?rev=1309495&r1=1309494&r2=1309495&view=diff
==============================================================================
--- openjpa/branches/2.2.x/pom.xml (original)
+++ openjpa/branches/2.2.x/pom.xml Wed Apr  4 17:15:50 2012
@@ -522,12 +522,12 @@
             <dependency>
                 <groupId>javax.xml.bind</groupId>
                 <artifactId>jaxb-api</artifactId>
-                <version>2.0</version>
+                <version>2.2.1</version>
             </dependency>
             <dependency>
                 <groupId>com.sun.xml.bind</groupId>
                 <artifactId>jaxb-impl</artifactId>
-                <version>2.0.5</version>
+                <version>2.2.1</version>
             </dependency>
             <dependency>
                 <groupId>hsqldb</groupId>

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java?rev=1309495&r1=1309494&r2=1309495&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
Wed Apr  4 17:15:50 2012
@@ -362,10 +362,12 @@ public class OracleDictionary
         for (Iterator itr = aliases.iterator(); itr.hasNext(); i++) {
             alias = itr.next();
             String asString = null;
-            if (alias instanceof SQLBuffer)
+            if (alias instanceof SQLBuffer) {
                 asString = ((SQLBuffer) alias).getSQL();
-            else
+                selectSQL.appendParamOnly((SQLBuffer) alias);
+            } else {
                 asString = alias.toString();
+            }
             selectSQL.append(asString);
             if (asString.indexOf(" AS ") == -1)
                 selectSQL.append(" AS c").append(String.valueOf(i));

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java?rev=1309495&r1=1309494&r2=1309495&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java Wed
Apr  4 17:15:50 2012
@@ -102,16 +102,23 @@ public final class SQLBuffer
      * Append all SQL and parameters of the given buffer.
      */
     public SQLBuffer append(SQLBuffer buf) {
-        append(buf, _sql.length(), (_params == null) ? 0 : _params.size(),
-            true);
+        append(buf, _sql.length(), (_params == null) ? 0 : _params.size(), true, false);
         return this;
     }
 
     /**
-     * Append all SQL and parameters of the given buffer at the given positions.
+     * Append parameters only if the given buffer at the given positions.
+    */
+    public SQLBuffer appendParamOnly(SQLBuffer buf) {
+        append(buf, _sql.length(), (_params == null) ? 0 : _params.size(), true, true);
+        return this;
+    }
+
+    /**
+     * Append parameters and/or SQL of the given buffer at the given positions.
      */
     private void append(SQLBuffer buf, int sqlIndex, int paramIndex,
-        boolean subsels) {
+        boolean subsels, boolean paramOnly) {
         if (subsels) {
             // only allow appending of buffers with subselects, not insertion
             if (_subsels != null && !_subsels.isEmpty()
@@ -128,10 +135,12 @@ public final class SQLBuffer
             }
         }
 
-        if (sqlIndex == _sql.length())
-            _sql.append(buf._sql.toString());
-        else
-            _sql.insert(sqlIndex, buf._sql.toString());
+        if (!paramOnly) {
+            if (sqlIndex == _sql.length())
+                _sql.append(buf._sql.toString());
+            else
+                _sql.insert(sqlIndex, buf._sql.toString());
+        }
 
         if (buf._params != null) {
             if (_params == null)
@@ -404,7 +413,7 @@ public final class SQLBuffer
             else
                 buf = sub.select.toSelect(false, sub.fetch);
             buf.resolveSubselects();
-            append(buf, sub.sqlIndex, sub.paramIndex, false);
+            append(buf, sub.sqlIndex, sub.paramIndex, false, false);
         }
         _subsels.clear();
     }

Modified: openjpa/trunk/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/pom.xml?rev=1309495&r1=1309494&r2=1309495&view=diff
==============================================================================
--- openjpa/trunk/pom.xml (original)
+++ openjpa/trunk/pom.xml Wed Apr  4 17:15:50 2012
@@ -522,12 +522,12 @@
             <dependency>
                 <groupId>javax.xml.bind</groupId>
                 <artifactId>jaxb-api</artifactId>
-                <version>2.0</version>
+                <version>2.2.1</version>
             </dependency>
             <dependency>
                 <groupId>com.sun.xml.bind</groupId>
                 <artifactId>jaxb-impl</artifactId>
-                <version>2.0.5</version>
+                <version>2.2.1</version>
             </dependency>
             <dependency>
                 <groupId>hsqldb</groupId>



Mime
View raw message