ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbe...@apache.org
Subject svn commit: r468836 - in /ibatis/trunk/java/mapper/mapper2: build/ src/com/ibatis/sqlmap/engine/builder/xml/ src/com/ibatis/sqlmap/engine/execution/ src/com/ibatis/sqlmap/engine/impl/ src/com/ibatis/sqlmap/engine/scope/ test/com/ibatis/sqlmap/maps/
Date Sun, 29 Oct 2006 05:29:42 GMT
Author: cbegin
Date: Sat Oct 28 22:29:41 2006
New Revision: 468836

URL: http://svn.apache.org/viewvc?view=rev&rev=468836
Log:
Added flag to enable/disable prepared statement caching.   Enabled by default.

Modified:
    ibatis/trunk/java/mapper/mapper2/build/version.properties
    ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapConfigParser.java
    ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/sql-map-config-2.dtd
    ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/execution/SqlExecutor.java
    ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/impl/SqlMapExecutorDelegate.java
    ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/scope/SessionScope.java
    ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/maps/SqlMapConfig.xml

Modified: ibatis/trunk/java/mapper/mapper2/build/version.properties
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/build/version.properties?view=diff&rev=468836&r1=468835&r2=468836
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/build/version.properties (original)
+++ ibatis/trunk/java/mapper/mapper2/build/version.properties Sat Oct 28 22:29:41 2006
@@ -1,5 +1,5 @@
 #Build version info
-#Sat Oct 28 22:50:41 MDT 2006
+#Sat Oct 28 23:25:57 MDT 2006
 version=2.2.1
-buildDate=2006/10/28 22\:50
-buildNum=659
+buildDate=2006/10/28 23\:25
+buildNum=664

Modified: ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapConfigParser.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapConfigParser.java?view=diff&rev=468836&r1=468835&r2=468836
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapConfigParser.java
(original)
+++ ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapConfigParser.java
Sat Oct 28 22:29:41 2006
@@ -157,6 +157,10 @@
         boolean lazyLoadingEnabled = (lazyLoadingEnabledAttr == null || "true".equals(lazyLoadingEnabledAttr));
         vars.client.getDelegate().setLazyLoadingEnabled(lazyLoadingEnabled);
 
+        String statementCachingEnabledAttr = attributes.getProperty("statementCachingEnabled");
+        boolean statementCachingEnabled = (statementCachingEnabledAttr == null || "true".equals(statementCachingEnabledAttr));
+        vars.client.getDelegate().setStatementCacheEnabled(statementCachingEnabled);
+
         String cacheModelsEnabledAttr = attributes.getProperty("cacheModelsEnabled");
         boolean cacheModelsEnabled = (cacheModelsEnabledAttr == null || "true".equals(cacheModelsEnabledAttr));
         vars.client.getDelegate().setCacheModelsEnabled(cacheModelsEnabled);

Modified: ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/sql-map-config-2.dtd
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/sql-map-config-2.dtd?view=diff&rev=468836&r1=468835&r2=468836
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/sql-map-config-2.dtd
(original)
+++ ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/sql-map-config-2.dtd
Sat Oct 28 22:29:41 2006
@@ -31,6 +31,7 @@
 <!ATTLIST settings
 classInfoCacheEnabled (true | false) #IMPLIED
 lazyLoadingEnabled (true | false) #IMPLIED
+statementCachingEnabled (true | false) #IMPLIED
 cacheModelsEnabled (true | false) #IMPLIED
 enhancementEnabled (true | false) #IMPLIED
 errorTracingEnabled (true | false) #IMPLIED

Modified: ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/execution/SqlExecutor.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/execution/SqlExecutor.java?view=diff&rev=468836&r1=468835&r2=468836
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/execution/SqlExecutor.java
(original)
+++ ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/execution/SqlExecutor.java
Sat Oct 28 22:29:41 2006
@@ -25,6 +25,7 @@
 import com.ibatis.sqlmap.engine.scope.RequestScope;
 import com.ibatis.sqlmap.engine.scope.SessionScope;
 import com.ibatis.sqlmap.engine.impl.ExtendedSqlMapClient;
+import com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate;
 import com.ibatis.sqlmap.engine.mapping.statement.DefaultRowHandler;
 
 import java.sql.*;
@@ -479,7 +480,8 @@
   }
 
   private static PreparedStatement prepareStatement(SessionScope session, Connection conn,
String sql) throws SQLException {
-    if (session.hasPreparedStatementFor(sql)) {
+    SqlMapExecutorDelegate delegate = ((ExtendedSqlMapClient)session.getSqlMapExecutor()).getDelegate();
+    if (delegate.isStatementCacheEnabled() && session.hasPreparedStatementFor(sql))
{
       return session.getPreparedStatement((sql));
     } else {
       PreparedStatement ps = conn.prepareStatement(sql);
@@ -489,7 +491,8 @@
   }
 
   private CallableStatement prepareCall(SessionScope session, Connection conn, String sql)
throws SQLException {
-    if (session.hasPreparedStatementFor(sql)) {
+    SqlMapExecutorDelegate delegate = ((ExtendedSqlMapClient)session.getSqlMapExecutor()).getDelegate();
+    if (delegate.isStatementCacheEnabled() && session.hasPreparedStatementFor(sql))
{
       return (CallableStatement) session.getPreparedStatement((sql));
     } else {
       CallableStatement cs = conn.prepareCall(sql);

Modified: ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/impl/SqlMapExecutorDelegate.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/impl/SqlMapExecutorDelegate.java?view=diff&rev=468836&r1=468835&r2=468836
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/impl/SqlMapExecutorDelegate.java
(original)
+++ ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/impl/SqlMapExecutorDelegate.java
Sat Oct 28 22:29:41 2006
@@ -94,6 +94,7 @@
   private DataExchangeFactory dataExchangeFactory;
   
   private ResultObjectFactory resultObjectFactory;
+  private boolean statementCacheEnabled;
 
   /**
    * Default constructor
@@ -945,5 +946,12 @@
     this.resultObjectFactory = resultObjectFactory;
   }
 
+  public boolean isStatementCacheEnabled() {
+    return statementCacheEnabled;
+  }
+
+  public void setStatementCacheEnabled(boolean statementCacheEnabled) {
+    this.statementCacheEnabled = statementCacheEnabled;
+  }
 }
 

Modified: ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/scope/SessionScope.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/scope/SessionScope.java?view=diff&rev=468836&r1=468835&r2=468836
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/scope/SessionScope.java
(original)
+++ ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/scope/SessionScope.java
Sat Oct 28 22:29:41 2006
@@ -311,4 +311,5 @@
   public void recallTransactionState() {
     transactionState = savedTransactionState;
   }
+
 }

Modified: ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/maps/SqlMapConfig.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/maps/SqlMapConfig.xml?view=diff&rev=468836&r1=468835&r2=468836
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/maps/SqlMapConfig.xml (original)
+++ ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/maps/SqlMapConfig.xml Sat Oct
28 22:29:41 2006
@@ -18,6 +18,7 @@
     cacheModelsEnabled="true"
     enhancementEnabled="false"
     lazyLoadingEnabled="true"
+    statementCachingEnabled="false"
     maxRequests="32"
     maxSessions="10"
     maxTransactions="5"



Mime
View raw message