cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1577911 - /cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OracleLOBBatchAction.java
Date Sat, 15 Mar 2014 17:41:34 GMT
Author: aadamchik
Date: Sat Mar 15 17:41:34 2014
New Revision: 1577911

URL: http://svn.apache.org/r1577911
Log:
CAY-1915 BatchTranslator instead of performing bindings should return binding object whose
values can be altered

Modified:
    cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OracleLOBBatchAction.java

Modified: cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OracleLOBBatchAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OracleLOBBatchAction.java?rev=1577911&r1=1577910&r2=1577911&view=diff
==============================================================================
--- cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OracleLOBBatchAction.java
(original)
+++ cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OracleLOBBatchAction.java
Sat Mar 15 17:41:34 2014
@@ -54,13 +54,14 @@ class OracleLOBBatchAction implements SQ
     DbAdapter adapter;
 
     protected JdbcEventLogger logger;
-    
+
     private static void bind(DbAdapter adapter, PreparedStatement statement, List<BatchParameterBinding>
bindings)
             throws SQLException, Exception {
         int len = bindings.size();
         for (int i = 0; i < len; i++) {
             BatchParameterBinding b = bindings.get(i);
-            adapter.bindParameter(statement, b.getValue(), i + 1, b.getAttribute().getType(),
b.getAttribute().getScale());
+            adapter.bindParameter(statement, b.getValue(), i + 1, b.getAttribute().getType(),
b.getAttribute()
+                    .getScale());
         }
     }
 
@@ -77,18 +78,18 @@ class OracleLOBBatchAction implements SQ
     @Override
     public void performAction(Connection connection, OperationObserver observer) throws SQLException,
Exception {
 
-        OracleLOBBatchTranslator queryBuilder;
+        OracleLOBBatchTranslator translator;
         if (query instanceof InsertBatchQuery) {
-            queryBuilder = new OracleLOBInsertBatchTranslator((InsertBatchQuery) query, getAdapter());
+            translator = new OracleLOBInsertBatchTranslator((InsertBatchQuery) query, getAdapter());
         } else if (query instanceof UpdateBatchQuery) {
-            queryBuilder = new OracleLOBUpdateBatchTranslator((UpdateBatchQuery) query, getAdapter());
+            translator = new OracleLOBUpdateBatchTranslator((UpdateBatchQuery) query, getAdapter());
         } else {
             throw new CayenneException("Unsupported batch type for special LOB processing:
" + query);
         }
 
-        queryBuilder.setTrimFunction(OracleAdapter.TRIM_FUNCTION);
-        queryBuilder.setNewBlobFunction(OracleAdapter.NEW_BLOB_FUNCTION);
-        queryBuilder.setNewClobFunction(OracleAdapter.NEW_CLOB_FUNCTION);
+        translator.setTrimFunction(OracleAdapter.TRIM_FUNCTION);
+        translator.setNewBlobFunction(OracleAdapter.NEW_BLOB_FUNCTION);
+        translator.setNewClobFunction(OracleAdapter.NEW_CLOB_FUNCTION);
 
         // no batching is done, queries are translated
         // for each batch set, since prepared statements
@@ -97,26 +98,21 @@ class OracleLOBBatchAction implements SQ
         OracleLOBBatchQueryWrapper selectQuery = new OracleLOBBatchQueryWrapper(query);
         List<DbAttribute> qualifierAttributes = selectQuery.getDbAttributesForLOBSelectQualifier();
 
-        boolean isLoggable = logger.isLoggable();
-
-        for(BatchQueryRow row : query.getRows()) {
+        for (BatchQueryRow row : query.getRows()) {
 
             selectQuery.indexLOBAttributes(row);
 
             int updated = 0;
-            String updateStr = queryBuilder.createSqlString(row);
+            String updateStr = translator.createSqlString(row);
 
             // 1. run row update
             logger.logQuery(updateStr, Collections.EMPTY_LIST);
             PreparedStatement statement = connection.prepareStatement(updateStr);
             try {
 
-                if (isLoggable) {
-                    List<Object> bindings = queryBuilder.getValuesForLOBUpdateParameters(row);
-                    logger.logQueryParameters("bind", null, bindings, query instanceof InsertBatchQuery);
-                }
-                
-                List<BatchParameterBinding> bindings = queryBuilder.createBindings(row);
+                List<BatchParameterBinding> bindings = translator.createBindings(row);
+                logger.logQueryParameters("bind", bindings);
+
                 bind(adapter, statement, bindings);
 
                 updated = statement.executeUpdate();
@@ -129,7 +125,7 @@ class OracleLOBBatchAction implements SQ
             }
 
             // 2. run row LOB update (SELECT...FOR UPDATE and writing out LOBs)
-            processLOBRow(connection, queryBuilder, selectQuery, qualifierAttributes, row);
+            processLOBRow(connection, translator, selectQuery, qualifierAttributes, row);
 
             // finally, notify delegate that the row was updated
             observer.nextCount(query, updated);



Mime
View raw message