openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r661200 - in /openjpa/trunk/openjpa-jdbc/src/main: java/org/apache/openjpa/jdbc/kernel/ java/org/apache/openjpa/jdbc/schema/ java/org/apache/openjpa/jdbc/sql/ resources/org/apache/openjpa/jdbc/kernel/ resources/org/apache/openjpa/jdbc/schem...
Date Thu, 29 May 2008 03:51:35 GMT
Author: fancy
Date: Wed May 28 20:51:34 2008
New Revision: 661200

URL: http://svn.apache.org/viewvc?rev=661200&view=rev
Log:
OPENJPA-617 Removed hardcoding platform string.
also relocated 2 jdbc trace messages.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
    openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties
    openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/schema/localizer.properties
    openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java?rev=661200&r1=661199&r2=661200&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java
Wed May 28 20:51:34 2008
@@ -238,13 +238,7 @@
         // DB2/ZOS        1 / 0           1 / 0        -2 / SQLException
         // Oracle        -2 / -2         -2 / -2       -2 / SQLException
         int cnt = 0;
-        int updateSuccessCnt = 0;
-        if (ps != null && _dict.platform.indexOf("Oracle") > -1)
-            updateSuccessCnt = ps.getUpdateCount();
-        if (_log.isTraceEnabled() &&
-            _dict.platform.indexOf("Oracle") > -1)
-            _log.trace(_loc.get("batch_update_success_count",
-                    updateSuccessCnt));
+        int updateSuccessCnt = _dict.getBatchUpdateCount(ps);
         Object failed = null;
         List batchedRows = getBatchedRows();
         for (int i = 0; i < count.length; i++) {
@@ -262,7 +256,7 @@
                         row.getSQL(_dict)).getMessage());
                 break;
             case Statement.SUCCESS_NO_INFO: // -2
-                if (_dict.platform.indexOf("Oracle") > -1 &&
+                if (_dict.reportsSuccessNoInfoOnBatchUpdates &&                 
  
                     updateSuccessCnt != count.length) {
                     // Oracle batching specifics:
                     // treat update/delete of SUCCESS_NO_INFO as failed case

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java?rev=661200&r1=661199&r2=661200&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
Wed May 28 20:51:34 2008
@@ -235,10 +235,6 @@
                 conn = ds.getConnection(conf.getConnection2UserName(), conf
                         .getConnection2Password());
 
-            if (log.isTraceEnabled())
-                log.trace(_loc.get("connection-defaults", new Object[]{
-                    conn.getAutoCommit(), conn.getHoldability(),
-                    conn.getTransactionIsolation()})); 
             return ds;
         } catch (Exception e) {
             throw new StoreException(e).setFatal(true);

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=661200&r1=661199&r2=661200&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Wed May 28 20:51:34 2008
@@ -236,6 +236,7 @@
     public boolean requiresCastForComparisons = false;
     public boolean supportsModOperator = false;
     public boolean supportsXMLColumn = false;
+    public boolean reportsSuccessNoInfoOnBatchUpdates = false;
 
     // functions
     public String castFunction = "CAST({0} AS {1})";
@@ -373,10 +374,25 @@
     public void connectedConfiguration(Connection conn)
         throws SQLException {
         if (!connected) {
+            DatabaseMetaData metaData = null;            
             try {
-                if (log.isTraceEnabled())
+                if (log.isTraceEnabled()) {
+                    metaData = conn.getMetaData();
+                    boolean isJDBC3 = false;
                     log.trace(DBDictionaryFactory.toString
-                        (conn.getMetaData()));
+                        (metaData));
+                    try {
+                        // JDBC3-only method, so it might throw a 
+                        // AbstractMethodError
+                        isJDBC3 = metaData.getJDBCMajorVersion() >= 3;
+                    } catch (Throwable t) {
+                        // ignore if not JDBC3
+                    }
+                    if (isJDBC3)
+                        log.trace(_loc.get("connection-defaults", new Object[]{
+                            conn.getAutoCommit(), conn.getHoldability(),
+                            conn.getTransactionIsolation()}));
+                }
             } catch (Exception e) {
                 log.trace(e.toString(), e);
             }
@@ -4411,4 +4427,13 @@
     public boolean needsToCreateIndex(Index idx, Table table) {
         return true;
     }
+
+    /**
+     * Return batched statements update succes count
+     * @param ps A PreparedStatement
+     * @return return update count
+     */
+    public int getBatchUpdateCount(PreparedStatement ps) throws SQLException {
+        return 0;
+    }
 }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java?rev=661200&r1=661199&r2=661200&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
Wed May 28 20:51:34 2008
@@ -165,6 +165,7 @@
         substringFunctionName = "SUBSTR";
         super.setBatchLimit(defaultBatchLimit);
         selectWordSet.add("WITH");
+        reportsSuccessNoInfoOnBatchUpdates = true;
     }
 
     public void endConfiguration() {
@@ -1104,4 +1105,15 @@
         throws SQLException {
         row.setNull(col);
     }
+
+    public int getBatchUpdateCount(PreparedStatement ps) throws SQLException {
+        int updateSuccessCnt = 0;
+        if (batchLimit > 0 && ps != null) {
+            updateSuccessCnt = ps.getUpdateCount();
+            if (log.isTraceEnabled())
+                log.trace(_loc.get("batch_update_success_count",
+                    updateSuccessCnt));
+        }
+        return updateSuccessCnt;
+    }
 }

Modified: openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties?rev=661200&r1=661199&r2=661200&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties
Wed May 28 20:51:34 2008
@@ -115,4 +115,3 @@
 	statement {1}.
 cache-hit: SQL Cache hit with key: {0} in {1}
 cache-missed: SQL Cache missed with key: {0} in {1}    
-batch_update_success_count: ExecuteBatch command returns update success count {0}
\ No newline at end of file

Modified: openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/schema/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/schema/localizer.properties?rev=661200&r1=661199&r2=661200&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/schema/localizer.properties
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/schema/localizer.properties
Wed May 28 20:51:34 2008
@@ -148,6 +148,4 @@
 delete-table-contents: An error occurred while attempting to delete all \
     records from all mapped tables.
 set-auto-commit: DataSource connection setAutoCommit to "{0}"
-connection-defaults: Initial connection autoCommit: {0}, holdability: {1}, \
-    TransactionIsolation: {2}
 

Modified: openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties?rev=661200&r1=661199&r2=661200&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
Wed May 28 20:51:34 2008
@@ -171,4 +171,7 @@
 stream-exception: Unexpected error recovering the row to stream the LOB.
 batch_unlimit: The batch limit was changed from unlimit (-1) to {0}.
 function-not-supported: The database dictionary in use ("{0}") \
-	does not support "{1}" function.
\ No newline at end of file
+	does not support "{1}" function.
+batch_update_success_count: ExecuteBatch command returns update success count {0}
+connection-defaults: Initial connection autoCommit: {0}, holdability: {1}, \
+    TransactionIsolation: {2}



Mime
View raw message