mirror of https://github.com/apache/openjpa.git
OPENJPA-617 Removed hardcoding platform string.
also relocated 2 jdbc trace messages. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@661200 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
faa0f26cdd
commit
93417f99e3
|
@ -238,13 +238,7 @@ public class BatchingPreparedStatementManagerImpl extends
|
|||
// 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 @@ public class BatchingPreparedStatementManagerImpl extends
|
|||
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
|
||||
|
|
|
@ -235,10 +235,6 @@ public class DataSourceFactory {
|
|||
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);
|
||||
|
|
|
@ -236,6 +236,7 @@ public class DBDictionary
|
|||
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 class DBDictionary
|
|||
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 class DBDictionary
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,6 +165,7 @@ public class OracleDictionary
|
|||
substringFunctionName = "SUBSTR";
|
||||
super.setBatchLimit(defaultBatchLimit);
|
||||
selectWordSet.add("WITH");
|
||||
reportsSuccessNoInfoOnBatchUpdates = true;
|
||||
}
|
||||
|
||||
public void endConfiguration() {
|
||||
|
@ -1104,4 +1105,15 @@ public class OracleDictionary
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,4 +115,3 @@ batch_update_info: ExecuteBatch command returns update count {0} for \
|
|||
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}
|
|
@ -148,6 +148,4 @@ no-custom-ds: use a custom DataSource
|
|||
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}
|
||||
|
||||
|
|
|
@ -171,4 +171,7 @@ db-not-supported: The database product "{0}", version "{1}" is not officially su
|
|||
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.
|
||||
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}
|
||||
|
|
Loading…
Reference in New Issue