mirror of
https://github.com/apache/openjpa.git
synced 2025-02-08 11:06:01 +00:00
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
|
// DB2/ZOS 1 / 0 1 / 0 -2 / SQLException
|
||||||
// Oracle -2 / -2 -2 / -2 -2 / SQLException
|
// Oracle -2 / -2 -2 / -2 -2 / SQLException
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
int updateSuccessCnt = 0;
|
int updateSuccessCnt = _dict.getBatchUpdateCount(ps);
|
||||||
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));
|
|
||||||
Object failed = null;
|
Object failed = null;
|
||||||
List batchedRows = getBatchedRows();
|
List batchedRows = getBatchedRows();
|
||||||
for (int i = 0; i < count.length; i++) {
|
for (int i = 0; i < count.length; i++) {
|
||||||
@ -262,7 +256,7 @@ public class BatchingPreparedStatementManagerImpl extends
|
|||||||
row.getSQL(_dict)).getMessage());
|
row.getSQL(_dict)).getMessage());
|
||||||
break;
|
break;
|
||||||
case Statement.SUCCESS_NO_INFO: // -2
|
case Statement.SUCCESS_NO_INFO: // -2
|
||||||
if (_dict.platform.indexOf("Oracle") > -1 &&
|
if (_dict.reportsSuccessNoInfoOnBatchUpdates &&
|
||||||
updateSuccessCnt != count.length) {
|
updateSuccessCnt != count.length) {
|
||||||
// Oracle batching specifics:
|
// Oracle batching specifics:
|
||||||
// treat update/delete of SUCCESS_NO_INFO as failed case
|
// treat update/delete of SUCCESS_NO_INFO as failed case
|
||||||
|
@ -235,10 +235,6 @@ public class DataSourceFactory {
|
|||||||
conn = ds.getConnection(conf.getConnection2UserName(), conf
|
conn = ds.getConnection(conf.getConnection2UserName(), conf
|
||||||
.getConnection2Password());
|
.getConnection2Password());
|
||||||
|
|
||||||
if (log.isTraceEnabled())
|
|
||||||
log.trace(_loc.get("connection-defaults", new Object[]{
|
|
||||||
conn.getAutoCommit(), conn.getHoldability(),
|
|
||||||
conn.getTransactionIsolation()}));
|
|
||||||
return ds;
|
return ds;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StoreException(e).setFatal(true);
|
throw new StoreException(e).setFatal(true);
|
||||||
|
@ -236,6 +236,7 @@ public class DBDictionary
|
|||||||
public boolean requiresCastForComparisons = false;
|
public boolean requiresCastForComparisons = false;
|
||||||
public boolean supportsModOperator = false;
|
public boolean supportsModOperator = false;
|
||||||
public boolean supportsXMLColumn = false;
|
public boolean supportsXMLColumn = false;
|
||||||
|
public boolean reportsSuccessNoInfoOnBatchUpdates = false;
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
public String castFunction = "CAST({0} AS {1})";
|
public String castFunction = "CAST({0} AS {1})";
|
||||||
@ -373,10 +374,25 @@ public class DBDictionary
|
|||||||
public void connectedConfiguration(Connection conn)
|
public void connectedConfiguration(Connection conn)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
if (!connected) {
|
if (!connected) {
|
||||||
|
DatabaseMetaData metaData = null;
|
||||||
try {
|
try {
|
||||||
if (log.isTraceEnabled())
|
if (log.isTraceEnabled()) {
|
||||||
|
metaData = conn.getMetaData();
|
||||||
|
boolean isJDBC3 = false;
|
||||||
log.trace(DBDictionaryFactory.toString
|
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) {
|
} catch (Exception e) {
|
||||||
log.trace(e.toString(), e);
|
log.trace(e.toString(), e);
|
||||||
}
|
}
|
||||||
@ -4411,4 +4427,13 @@ public class DBDictionary
|
|||||||
public boolean needsToCreateIndex(Index idx, Table table) {
|
public boolean needsToCreateIndex(Index idx, Table table) {
|
||||||
return true;
|
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";
|
substringFunctionName = "SUBSTR";
|
||||||
super.setBatchLimit(defaultBatchLimit);
|
super.setBatchLimit(defaultBatchLimit);
|
||||||
selectWordSet.add("WITH");
|
selectWordSet.add("WITH");
|
||||||
|
reportsSuccessNoInfoOnBatchUpdates = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void endConfiguration() {
|
public void endConfiguration() {
|
||||||
@ -1104,4 +1105,15 @@ public class OracleDictionary
|
|||||||
throws SQLException {
|
throws SQLException {
|
||||||
row.setNull(col);
|
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}.
|
statement {1}.
|
||||||
cache-hit: SQL Cache hit with key: {0} in {1}
|
cache-hit: SQL Cache hit with key: {0} in {1}
|
||||||
cache-missed: SQL Cache missed 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 \
|
delete-table-contents: An error occurred while attempting to delete all \
|
||||||
records from all mapped tables.
|
records from all mapped tables.
|
||||||
set-auto-commit: DataSource connection setAutoCommit to "{0}"
|
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.
|
stream-exception: Unexpected error recovering the row to stream the LOB.
|
||||||
batch_unlimit: The batch limit was changed from unlimit (-1) to {0}.
|
batch_unlimit: The batch limit was changed from unlimit (-1) to {0}.
|
||||||
function-not-supported: The database dictionary in use ("{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…
x
Reference in New Issue
Block a user