cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r764555 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/
Date Mon, 13 Apr 2009 18:49:01 GMT
Author: aadamchik
Date: Mon Apr 13 18:49:00 2009
New Revision: 764555

URL: http://svn.apache.org/viewvc?rev=764555&view=rev
Log:
CAY-1207 Oracle8 does not like new join syntax

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8JoinStack.java
      - copied, changed from r764550, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseJoinStack.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SelectAction.java
      - copied, changed from r764550, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SelectTranslator.java
      - copied, changed from r764550, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseSelectTranslator.java
Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseJoinStack.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseSelectTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=764555&r1=764554&r2=764555&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Mon Apr 13 18:49:00 2009
@@ -52,6 +52,7 @@
 CAY-1194 problems with relationships when using nested contexts and ROP
 CAY-1196 CayenneRuntimeException in modeler due to ClassNotFoundException when java type
is invalid and db attribute is null
 CAY-1204 Incorrect relationship syncing in nested CayenneContext's
+CAY-1207 Oracle8 does not like new join syntax
 
 ----------------------------------
 Release: 3.0M5

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseJoinStack.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseJoinStack.java?rev=764555&r1=764554&r2=764555&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseJoinStack.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseJoinStack.java
Mon Apr 13 18:49:00 2009
@@ -23,6 +23,8 @@
 
 import org.apache.cayenne.access.trans.JoinStack;
 import org.apache.cayenne.access.trans.JoinTreeNode;
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbJoin;
 import org.apache.cayenne.map.DbRelationship;
@@ -31,12 +33,14 @@
  * OpenBase does not support standard JOIN keyword and have strange syntax for defining
  * inner/outer joins
  * 
- * @see http://www.openbase.com/help/KnowledgeBase/400_OpenBaseSQL/401_SelectStatements.html
+ * @see http
+ *      ://www.openbase.com/help/KnowledgeBase/400_OpenBaseSQL/401_SelectStatements.html
+ * @since 3.0
  */
-public class OpenBaseJoinStack extends JoinStack {
+class OpenBaseJoinStack extends JoinStack {
 
-    public OpenBaseJoinStack() {
-        super();
+    protected OpenBaseJoinStack(DbAdapter dbAdapter, DataMap dataMap) {
+        super(dbAdapter, dataMap);
     }
 
     @Override
@@ -60,7 +64,8 @@
     }
 
     @Override
-    protected void appendQualifier(Appendable out, boolean firstQualifierElement) throws
IOException {
+    protected void appendQualifier(Appendable out, boolean firstQualifierElement)
+            throws IOException {
         boolean first = firstQualifierElement;
         for (JoinTreeNode node : rootNode.getChildren()) {
             if (!first) {
@@ -100,7 +105,7 @@
                     throw new IllegalArgumentException("Unsupported join type: "
                             + node.getJoinType());
             }
-            
+
             out.append(targetAlias).append('.').append(join.getTargetName());
 
         }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseSelectTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseSelectTranslator.java?rev=764555&r1=764554&r2=764555&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseSelectTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseSelectTranslator.java
Mon Apr 13 18:49:00 2009
@@ -29,7 +29,7 @@
 
     @Override
     protected JoinStack createJoinStack() {
-        return new OpenBaseJoinStack();
+        return new OpenBaseJoinStack(getAdapter(), queryMetadata.getDataMap());
     }
 
     @Override

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java?rev=764555&r1=764554&r2=764555&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java
Mon Apr 13 18:49:00 2009
@@ -23,6 +23,7 @@
 import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.query.SQLAction;
 import org.apache.cayenne.query.SQLTemplate;
+import org.apache.cayenne.query.SelectQuery;
 
 /**
  * An action builder for Oracle8Adapter.
@@ -39,4 +40,9 @@
     public SQLAction sqlAction(SQLTemplate query) {
         return new Oracle8SQLTemplateAction(query, adapter, getEntityResolver());
     }
+
+    @Override
+    public SQLAction objectSelectAction(SelectQuery query) {
+        return new Oracle8SelectAction(query, getAdapter(), getEntityResolver());
+    }
 }

Copied: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8JoinStack.java
(from r764550, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseJoinStack.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8JoinStack.java?p2=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8JoinStack.java&p1=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseJoinStack.java&r1=764550&r2=764555&rev=764555&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseJoinStack.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8JoinStack.java
Mon Apr 13 18:49:00 2009
@@ -16,27 +16,27 @@
  *  specific language governing permissions and limitations
  *  under the License.
  ****************************************************************/
-package org.apache.cayenne.dba.openbase;
+package org.apache.cayenne.dba.oracle;
 
 import java.io.IOException;
 import java.util.List;
 
 import org.apache.cayenne.access.trans.JoinStack;
 import org.apache.cayenne.access.trans.JoinTreeNode;
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbJoin;
 import org.apache.cayenne.map.DbRelationship;
 
 /**
- * OpenBase does not support standard JOIN keyword and have strange syntax for defining
- * inner/outer joins
- * 
- * @see http://www.openbase.com/help/KnowledgeBase/400_OpenBaseSQL/401_SelectStatements.html
+ * @since 3.0
  */
-public class OpenBaseJoinStack extends JoinStack {
+// cloned from OpenBaseJoin stack... need better strategies of reuse...
+class Oracle8JoinStack extends JoinStack {
 
-    public OpenBaseJoinStack() {
-        super();
+    Oracle8JoinStack(DbAdapter dbAdapter, DataMap dataMap) {
+        super(dbAdapter, dataMap);
     }
 
     @Override
@@ -60,7 +60,8 @@
     }
 
     @Override
-    protected void appendQualifier(Appendable out, boolean firstQualifierElement) throws
IOException {
+    protected void appendQualifier(Appendable out, boolean firstQualifierElement)
+            throws IOException {
         boolean first = firstQualifierElement;
         for (JoinTreeNode node : rootNode.getChildren()) {
             if (!first) {
@@ -100,16 +101,13 @@
                     throw new IllegalArgumentException("Unsupported join type: "
                             + node.getJoinType());
             }
-            
-            out.append(targetAlias).append('.').append(join.getTargetName());
 
+            out.append(targetAlias).append('.').append(join.getTargetName());
         }
 
         for (JoinTreeNode child : node.getChildren()) {
             out.append(" AND ");
             appendQualifierSubtree(out, child);
         }
-
     }
-
 }

Copied: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SelectAction.java
(from r764550, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SelectAction.java?p2=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SelectAction.java&p1=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java&r1=764550&r2=764555&rev=764555&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SelectAction.java
Mon Apr 13 18:49:00 2009
@@ -16,27 +16,32 @@
  *  specific language governing permissions and limitations
  *  under the License.
  ****************************************************************/
-
 package org.apache.cayenne.dba.oracle;
 
-import org.apache.cayenne.dba.JdbcAdapter;
+import java.sql.Connection;
+
+import org.apache.cayenne.access.trans.SelectTranslator;
+import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.map.EntityResolver;
-import org.apache.cayenne.query.SQLAction;
-import org.apache.cayenne.query.SQLTemplate;
+import org.apache.cayenne.query.SelectQuery;
 
 /**
- * An action builder for Oracle8Adapter.
- * 
- * @since 1.2
+ * @since 3.0
  */
-class Oracle8ActionBuilder extends OracleActionBuilder {
+class Oracle8SelectAction extends OracleSelectAction {
 
-    Oracle8ActionBuilder(JdbcAdapter adapter, EntityResolver resolver) {
-        super(adapter, resolver);
+    Oracle8SelectAction(SelectQuery query, DbAdapter adapter,
+            EntityResolver entityResolver) {
+        super(query, adapter, entityResolver);
     }
 
     @Override
-    public SQLAction sqlAction(SQLTemplate query) {
-        return new Oracle8SQLTemplateAction(query, adapter, getEntityResolver());
+    protected SelectTranslator createTranslator(Connection connection) {
+        SelectTranslator translator = new Oracle8SelectTranslator();
+        translator.setQuery(query);
+        translator.setAdapter(adapter);
+        translator.setEntityResolver(getEntityResolver());
+        translator.setConnection(connection);
+        return translator;
     }
 }

Copied: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SelectTranslator.java
(from r764550, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseSelectTranslator.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SelectTranslator.java?p2=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SelectTranslator.java&p1=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseSelectTranslator.java&r1=764550&r2=764555&rev=764555&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseSelectTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SelectTranslator.java
Mon Apr 13 18:49:00 2009
@@ -16,28 +16,22 @@
  *  specific language governing permissions and limitations
  *  under the License.
  ****************************************************************/
-
-package org.apache.cayenne.dba.openbase;
+package org.apache.cayenne.dba.oracle;
 
 import org.apache.cayenne.access.trans.JoinStack;
-import org.apache.cayenne.access.trans.SelectTranslator;
 
 /**
- * @since 1.2
+ * @since 3.0
  */
-class OpenBaseSelectTranslator extends SelectTranslator {
+public class Oracle8SelectTranslator extends OracleSelectTranslator {
 
+    /**
+     * Returns an old style joint stack for Oracle8 that does not support explicit join
+     * syntax.
+     */
     @Override
     protected JoinStack createJoinStack() {
-        return new OpenBaseJoinStack();
-    }
-
-    @Override
-    protected void appendLimitAndOffsetClauses(StringBuilder buffer) {
-        int limit = queryMetadata.getFetchLimit();
-        if (limit > 0) {
-            buffer.append(" RETURN RESULTS ").append(limit);
-        }
+        return new Oracle8JoinStack(getAdapter(), queryMetadata.getDataMap());
     }
 
 }



Mime
View raw message