You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2011/07/15 21:16:03 UTC

svn commit: r1147286 - in /db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque: sql/SqlBuilder.java util/Criteria.java

Author: tfischer
Date: Fri Jul 15 19:16:02 2011
New Revision: 1147286

URL: http://svn.apache.org/viewvc?rev=1147286&view=rev
Log:
TORQUE-167: remove the field db from Criteria.Criterion

Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java?rev=1147286&r1=1147285&r2=1147286&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java Fri Jul 15 19:16:02 2011
@@ -387,7 +387,6 @@ public final class SqlBuilder
                 Query query)
             throws TorqueException
     {
-        criterion.setDB(db);
         String tableName = criterion.getTable();
 
         if (tableName != null)
@@ -439,7 +438,7 @@ public final class SqlBuilder
             = buildPs(
                 whereClausePartInput,
                 ignoreCase,
-                criterion.getDb());
+                db);
         sb.append(whereClausePartOutput.getSql());
         query.getPreparedStatementReplacements().addAll(
                 whereClausePartOutput.getPreparedStatementReplacements());

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java?rev=1147286&r1=1147285&r2=1147286&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java Fri Jul 15 19:16:02 2011
@@ -38,7 +38,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.torque.Torque;
 import org.apache.torque.TorqueException;
-import org.apache.torque.adapter.DB;
 import org.apache.torque.om.ObjectKey;
 
 /**
@@ -3068,12 +3067,6 @@ public class Criteria implements Seriali
         private boolean ignoreStringCase = false;
 
         /**
-         * The DB adaptor which might be used to get db specific
-         * variations of sql.
-         */
-        private DB db;
-
-        /**
          * other connected criteria.
          */
         private List<Criterion> clauses = new ArrayList<Criterion>();
@@ -3234,53 +3227,6 @@ public class Criteria implements Seriali
         }
 
         /**
-         * Get the value of db.
-         * The DB adaptor which might be used to get db specific
-         * variations of sql.
-         * @return value of db.
-         */
-        public DB getDb()
-        {
-            if (this.db == null)
-            {
-                // db may not be set if generating preliminary sql for
-                // debugging.
-                try
-                {
-                    return Torque.getDB(getDbName());
-                }
-                catch (Exception e)
-                {
-                    // we are only doing this to allow easier debugging, so
-                    // no need to throw up the exception, just make note of it.
-                    log.error(
-                            "Could not get a DB adapter, so sql may be wrong");
-                    return null;
-                }
-            }
-            else
-            {
-                return this.db;
-            }
-        }
-
-        /**
-         * Set the value of db.
-         * The DB adaptor might be used to get db specific
-         * variations of sql.
-         * @param v  Value to assign to db.
-         */
-        public void setDB(DB v)
-        {
-            this.db = v;
-
-            for (int i = 0; i < this.clauses.size(); i++)
-            {
-                ((clauses.get(i))).setDB(v);
-            }
-        }
-
-        /**
          * Sets ignore case.
          *
          * @param b True if case should be ignored.



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org