Skip to content

Commit bac7018

Browse files
author
w.dehai
committed
refact: simpler class StatementUtil.
1 parent fa8d9a0 commit bac7018

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/main/java/org/apache/ibatis/executor/statement/StatementUtil.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,8 @@ private StatementUtil() {
4141
* @throws SQLException if a database access error occurs, this method is called on a closed <code>Statement</code>
4242
*/
4343
public static void applyTransactionTimeout(Statement statement, Integer queryTimeout, Integer transactionTimeout) throws SQLException {
44-
if (transactionTimeout == null){
45-
return;
46-
}
47-
Integer timeToLiveOfQuery = null;
48-
if (queryTimeout == null || queryTimeout == 0 || transactionTimeout < queryTimeout) {
49-
timeToLiveOfQuery = transactionTimeout;
50-
}
51-
if (timeToLiveOfQuery != null) {
52-
statement.setQueryTimeout(timeToLiveOfQuery);
44+
if (transactionTimeout != null && queryTimeout == null || queryTimeout == 0 || transactionTimeout < queryTimeout) {
45+
statement.setQueryTimeout(transactionTimeout);
5346
}
5447
}
5548

0 commit comments

Comments
 (0)