Skip to content

Commit

Permalink
fix #472
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Nov 27, 2017
1 parent 2f20642 commit 28dad51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 36 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
1. [ISSUE #436](https://github.com/shardingjdbc/sharding-jdbc/issues/436) 读写分离多从库配置RoundRobin算法并使用MyBatis时,只能路由到同一从库
1. [ISSUE #452](https://github.com/shardingjdbc/sharding-jdbc/issues/452) DDL语句分片至多个表会造成连接泄漏的问题
1. [ISSUE #453](https://github.com/shardingjdbc/sharding-jdbc/issues/453) 编排治理数据源配置name与Druid数据源name冲突
1. [ISSUE #472](https://github.com/shardingjdbc/sharding-jdbc/issues/472) Connection执行createStatement之前, 先调用getMetaData再setAutoCommit无法对之后创建的数据库真实连接生效

## 1.5.4.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ public final boolean getAutoCommit() throws SQLException {
@Override
public final void setAutoCommit(final boolean autoCommit) throws SQLException {
this.autoCommit = autoCommit;
if (cachedConnections.isEmpty()) {
recordMethodInvocation(Connection.class, "setAutoCommit", new Class[] {boolean.class}, new Object[] {autoCommit});
return;
}
recordMethodInvocation(Connection.class, "setAutoCommit", new Class[] {boolean.class}, new Object[] {autoCommit});
for (Connection each : cachedConnections.values()) {
each.setAutoCommit(autoCommit);
}
Expand Down Expand Up @@ -117,10 +114,7 @@ public final boolean isReadOnly() throws SQLException {
@Override
public final void setReadOnly(final boolean readOnly) throws SQLException {
this.readOnly = readOnly;
if (cachedConnections.isEmpty()) {
recordMethodInvocation(Connection.class, "setReadOnly", new Class[] {boolean.class}, new Object[] {readOnly});
return;
}
recordMethodInvocation(Connection.class, "setReadOnly", new Class[] {boolean.class}, new Object[] {readOnly});
for (Connection each : cachedConnections.values()) {
each.setReadOnly(readOnly);
}
Expand All @@ -134,10 +128,7 @@ public final int getTransactionIsolation() throws SQLException {
@Override
public final void setTransactionIsolation(final int level) throws SQLException {
transactionIsolation = level;
if (cachedConnections.isEmpty()) {
recordMethodInvocation(Connection.class, "setTransactionIsolation", new Class[] {int.class}, new Object[] {level});
return;
}
recordMethodInvocation(Connection.class, "setTransactionIsolation", new Class[] {int.class}, new Object[] {level});
for (Connection each : cachedConnections.values()) {
each.setTransactionIsolation(level);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ public final boolean isPoolable() throws SQLException {
@Override
public final void setPoolable(final boolean poolable) throws SQLException {
this.poolable = poolable;
if (getRoutedStatements().isEmpty()) {
recordMethodInvocation(targetClass, "setPoolable", new Class[] {boolean.class}, new Object[] {poolable});
return;
}
recordMethodInvocation(targetClass, "setPoolable", new Class[] {boolean.class}, new Object[] {poolable});
for (Statement each : getRoutedStatements()) {
each.setPoolable(poolable);
}
Expand All @@ -88,21 +85,15 @@ public final int getFetchSize() throws SQLException {
@Override
public final void setFetchSize(final int rows) throws SQLException {
this.fetchSize = rows;
if (getRoutedStatements().isEmpty()) {
recordMethodInvocation(targetClass, "setFetchSize", new Class[] {int.class}, new Object[] {rows});
return;
}
recordMethodInvocation(targetClass, "setFetchSize", new Class[] {int.class}, new Object[] {rows});
for (Statement each : getRoutedStatements()) {
each.setFetchSize(rows);
}
}

@Override
public final void setEscapeProcessing(final boolean enable) throws SQLException {
if (getRoutedStatements().isEmpty()) {
recordMethodInvocation(targetClass, "setEscapeProcessing", new Class[] {boolean.class}, new Object[] {enable});
return;
}
recordMethodInvocation(targetClass, "setEscapeProcessing", new Class[] {boolean.class}, new Object[] {enable});
for (Statement each : getRoutedStatements()) {
each.setEscapeProcessing(enable);
}
Expand Down Expand Up @@ -157,10 +148,7 @@ public final int getMaxFieldSize() throws SQLException {

@Override
public final void setMaxFieldSize(final int max) throws SQLException {
if (getRoutedStatements().isEmpty()) {
recordMethodInvocation(targetClass, "setMaxFieldSize", new Class[] {int.class}, new Object[] {max});
return;
}
recordMethodInvocation(targetClass, "setMaxFieldSize", new Class[] {int.class}, new Object[] {max});
for (Statement each : getRoutedStatements()) {
each.setMaxFieldSize(max);
}
Expand All @@ -174,10 +162,7 @@ public final int getMaxRows() throws SQLException {

@Override
public final void setMaxRows(final int max) throws SQLException {
if (getRoutedStatements().isEmpty()) {
recordMethodInvocation(targetClass, "setMaxRows", new Class[] {int.class}, new Object[] {max});
return;
}
recordMethodInvocation(targetClass, "setMaxRows", new Class[] {int.class}, new Object[] {max});
for (Statement each : getRoutedStatements()) {
each.setMaxRows(max);
}
Expand All @@ -190,10 +175,7 @@ public final int getQueryTimeout() throws SQLException {

@Override
public final void setQueryTimeout(final int seconds) throws SQLException {
if (getRoutedStatements().isEmpty()) {
recordMethodInvocation(targetClass, "setQueryTimeout", new Class[] {int.class}, new Object[] {seconds});
return;
}
recordMethodInvocation(targetClass, "setQueryTimeout", new Class[] {int.class}, new Object[] {seconds});
for (Statement each : getRoutedStatements()) {
each.setQueryTimeout(seconds);
}
Expand Down

0 comments on commit 28dad51

Please sign in to comment.