openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r448405 - in /incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc: kernel/JDBCStoreManager.java sql/LogicalUnion.java sql/SelectImpl.java
Date Wed, 20 Sep 2006 23:42:41 GMT
Author: pcl
Date: Wed Sep 20 16:42:41 2006
New Revision: 448405

URL: http://svn.apache.org/viewvc?view=rev&rev=448405
Log:
added some extension points for sql pluggability

Modified:
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java?view=diff&rev=448405&r1=448404&r2=448405
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
(original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
Wed Sep 20 16:42:41 2006
@@ -730,9 +730,9 @@
 
     /**
      * Connect to the database. This method is separated out so that it
-     * can be profiled.
+     * can be overridden.
      */
-    private RefCountConnection connectInternal() throws SQLException {
+    protected RefCountConnection connectInternal() throws SQLException {
         return new RefCountConnection(_ds.getConnection());
     }
 
@@ -1237,7 +1237,7 @@
      * Connection wrapper that keeps an internal ref count so that it knows
      * when to really close.
      */
-    private class RefCountConnection extends DelegatingConnection {
+    protected class RefCountConnection extends DelegatingConnection {
 
         private boolean _retain = false;
         private int _refs = 0;

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java?view=diff&rev=448405&r1=448404&r2=448405
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java
(original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java
Wed Sep 20 16:42:41 2006
@@ -85,7 +85,8 @@
 
         SelectImpl seed;
         for (int i = 0; i < sels; i++) {
-            seed = (seeds == null) ? new SelectImpl(conf)
+            seed = (seeds == null)
+                ? (SelectImpl) conf.getSQLFactoryInstance().newSelect()
                 : (SelectImpl) seeds[i];
             this.sels[i] = newUnionSelect(seed, i);
         }

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java?view=diff&rev=448405&r1=448404&r2=448405
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
(original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
Wed Sep 20 16:42:41 2006
@@ -283,7 +283,7 @@
         throws SQLException {
         if (fetch == null)
             fetch = store.getFetchConfiguration();
-        return execute(this, store.getContext(), store, fetch,
+        return execute(store.getContext(), store, fetch,
             fetch.getReadLockLevel());
     }
 
@@ -292,31 +292,31 @@
         throws SQLException {
         if (fetch == null)
             fetch = store.getFetchConfiguration();
-        return execute(this, store.getContext(), store, fetch, lockLevel);
+        return execute(store.getContext(), store, fetch, lockLevel);
     }
 
     /**
      * Execute this select in the context of the given store manager. The
      * context is passed in separately for profiling purposes.
      */
-    private static Result execute(SelectImpl sel, StoreContext ctx,
-        JDBCStore store, JDBCFetchConfiguration fetch, int lockLevel)
+    protected Result execute(StoreContext ctx, JDBCStore store, 
+        JDBCFetchConfiguration fetch, int lockLevel)
         throws SQLException {
         boolean forUpdate = false;
-        if (!sel.isAggregate() && sel._grouping == null) {
+        if (!isAggregate() && _grouping == null) {
             JDBCLockManager lm = store.getLockManager();
             if (lm != null)
-                forUpdate = lm.selectForUpdate(sel, lockLevel);
+                forUpdate = lm.selectForUpdate(this, lockLevel);
         }
 
-        SQLBuffer sql = sel.toSelect(forUpdate, fetch);
-        int rsType = (sel.isLRS() && sel.supportsRandomAccess(forUpdate))
+        SQLBuffer sql = toSelect(forUpdate, fetch);
+        int rsType = (isLRS() && supportsRandomAccess(forUpdate))
             ? -1 : ResultSet.TYPE_FORWARD_ONLY;
         Connection conn = store.getConnection();
         PreparedStatement stmnt = null;
         ResultSet rs = null;
         try {
-            if (sel.isLRS())
+            if (isLRS())
                 stmnt = sql.prepareStatement(conn, fetch, rsType, -1);
             else
                 stmnt = sql.prepareStatement(conn, rsType, -1);
@@ -329,12 +329,12 @@
             throw se;
         }
 
-        SelectResult res = new SelectResult(conn, stmnt, rs, sel._dict);
-        res.setSelect(sel);
+        SelectResult res = new SelectResult(conn, stmnt, rs, _dict);
+        res.setSelect(this);
         res.setStore(store);
         res.setLocking(forUpdate);
         try {
-            addEagerResults(res, sel, store, fetch);
+            addEagerResults(res, this, store, fetch);
         } catch (SQLException se) {
             res.close();
             throw se;
@@ -1470,7 +1470,7 @@
         Select[] clones = null;
         SelectImpl sel;
         for (int i = 0; i < sels; i++) {
-            sel = new SelectImpl(_conf);
+            sel = (SelectImpl) conf.getSQLFactoryInstance().newSelect();
             sel._flags = _flags;
             sel._flags &= ~AGGREGATE;
             sel._flags &= ~OUTER;



Mime
View raw message