mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
support useLocalSessionState config, default is true
This commit is contained in:
@@ -830,6 +830,13 @@ public class DruidPooledConnection extends PoolableWrapper implements javax.sql.
|
||||
@Override
|
||||
public void setReadOnly(boolean readOnly) throws SQLException {
|
||||
checkState();
|
||||
|
||||
boolean useLocalSessionState = holder.getDataSource().isUseLocalSessionState();
|
||||
if (useLocalSessionState) {
|
||||
if (readOnly == holder.isUnderlyingReadOnly()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
conn.setReadOnly(readOnly);
|
||||
holder.setUnderlyingReadOnly(readOnly);
|
||||
@@ -859,6 +866,13 @@ public class DruidPooledConnection extends PoolableWrapper implements javax.sql.
|
||||
@Override
|
||||
public void setTransactionIsolation(int level) throws SQLException {
|
||||
checkState();
|
||||
|
||||
boolean useLocalSessionState = holder.getDataSource().isUseLocalSessionState();
|
||||
if (useLocalSessionState) {
|
||||
if (level == holder.getUnderlyingTransactionIsolation()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
conn.setTransactionIsolation(level);
|
||||
holder.setUnderlyingTransactionIsolation(level);
|
||||
@@ -902,6 +916,13 @@ public class DruidPooledConnection extends PoolableWrapper implements javax.sql.
|
||||
@Override
|
||||
public void setHoldability(int holdability) throws SQLException {
|
||||
checkState();
|
||||
|
||||
boolean useLocalSessionState = holder.getDataSource().isUseLocalSessionState();
|
||||
if (useLocalSessionState) {
|
||||
if (holdability == holder.getUnderlyingHoldability()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
conn.setHoldability(holdability);
|
||||
holder.setUnderlyingHoldability(holdability);
|
||||
|
||||
Reference in New Issue
Block a user