mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved jdk7 support & postgresql support.
This commit is contained in:
@@ -203,6 +203,10 @@ public class DruidPooledConnection extends PoolableWrapper implements javax.sql.
|
||||
|
||||
@Override
|
||||
public Connection getConnection() {
|
||||
if (!holder.isUnderlyingAutoCommit()) {
|
||||
createTransactionInfo();
|
||||
}
|
||||
|
||||
return conn;
|
||||
}
|
||||
|
||||
@@ -755,6 +759,12 @@ public class DruidPooledConnection extends PoolableWrapper implements javax.sql.
|
||||
return transactionInfo;
|
||||
}
|
||||
|
||||
protected void createTransactionInfo() {
|
||||
DruidAbstractDataSource dataSource = holder.getDataSource();
|
||||
dataSource.incrementStartTransactionCount();
|
||||
transactionInfo = new TransactionInfo(dataSource.createTransactionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollback() throws SQLException {
|
||||
if (transactionInfo == null) {
|
||||
@@ -859,6 +869,10 @@ public class DruidPooledConnection extends PoolableWrapper implements javax.sql.
|
||||
public DatabaseMetaData getMetaData() throws SQLException {
|
||||
checkState();
|
||||
|
||||
if (!holder.isUnderlyingAutoCommit()) {
|
||||
createTransactionInfo();
|
||||
}
|
||||
|
||||
return conn.getMetaData();
|
||||
}
|
||||
|
||||
@@ -983,6 +997,10 @@ public class DruidPooledConnection extends PoolableWrapper implements javax.sql.
|
||||
public int getHoldability() throws SQLException {
|
||||
checkState();
|
||||
|
||||
if (!holder.isUnderlyingAutoCommit()) {
|
||||
createTransactionInfo();
|
||||
}
|
||||
|
||||
return conn.getHoldability();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user