You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2013/09/13 16:00:48 UTC

svn commit: r1522937 - in /empire-db/trunk/empire-db/src/main/java/org/apache/empire/db: DBCommand.java oracle/DBCommandOracle.java

Author: doebele
Date: Fri Sep 13 14:00:48 2013
New Revision: 1522937

URL: http://svn.apache.org/r1522937
Log:
EMPIREDB-192
improvement

Modified:
    empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java
    empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java?rev=1522937&r1=1522936&r2=1522937&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java Fri Sep 13 14:00:48 2013
@@ -266,19 +266,30 @@ public abstract class DBCommand extends 
         }
     }
     
+    /**
+     * returns true if prepared statements are enabled for this database
+     */
+    protected boolean isPreparedStatementsEnabled()
+    {
+        return db.isPreparedStatementsEnabled();
+    }
+    
+    /**
+     * returns true if a cmdParam should be used for the given column or false otherwise
+     */
     protected boolean useCmdParam(DBColumn col, Object value)
     {
         // Cannot wrap DBExpr or DBSystemDate
         if (value instanceof DBExpr || value instanceof DBDatabase.DBSystemDate)
             return false;
         // Check if prepared statements are enabled
-        if (db.isPreparedStatementsEnabled())
+        if (isPreparedStatementsEnabled())
             return true;
         // Only use a command param if column is of type BLOB or CLOB
         DataType dt = col.getDataType();
         return ( dt==DataType.BLOB || dt==DataType.CLOB );
     }
-
+    
     /**
      * Inserts DBSetExpr objects to the Vector 'set'.
      * 

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java?rev=1522937&r1=1522936&r2=1522937&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java Fri Sep 13 14:00:48 2013
@@ -157,7 +157,7 @@ public class DBCommandOracle extends DBC
         if (select == null)
             throw new ObjectNotValidException(this);
         // limit rows
-        boolean usePreparedStatements = getDatabase().isPreparedStatementsEnabled();
+        boolean usePreparedStatements = isPreparedStatementsEnabled();
         if (limitRows>=0)
         {   // add limitRows and skipRows wrapper
             buf.append("SELECT * FROM (");