1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/DatabaseConnection.java Fri Dec 27 18:30:37 2013 +0100
1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/DatabaseConnection.java Fri Dec 27 19:33:46 2013 +0100
1.3 @@ -26,6 +26,7 @@
1.4 import java.sql.PreparedStatement;
1.5 import java.sql.ResultSet;
1.6 import java.sql.SQLException;
1.7 +import java.sql.SQLWarning;
1.8 import java.util.logging.Level;
1.9 import java.util.logging.Logger;
1.10
1.11 @@ -73,6 +74,7 @@
1.12 } else {
1.13 processUpdateResult(sqlCommand, ps, formatter);
1.14 }
1.15 + logWarnings(ps);
1.16
1.17 while (ps.getMoreResults() || ps.getUpdateCount() > -1) {
1.18 ResultSet rs = ps.getResultSet();
1.19 @@ -82,6 +84,7 @@
1.20 processResultSet(sqlCommand, rs, formatter);
1.21 rs.close();
1.22 }
1.23 + logWarnings(ps);
1.24 }
1.25 }
1.26 }
1.27 @@ -120,6 +123,15 @@
1.28
1.29 }
1.30
1.31 + private void logWarnings(PreparedStatement ps) throws SQLException {
1.32 + SQLWarning w = ps.getWarnings();
1.33 + while (w != null) {
1.34 + log.log(Level.WARNING, "SQL: {0}", w.getLocalizedMessage());
1.35 + w = w.getNextWarning();
1.36 + }
1.37 + ps.clearWarnings();
1.38 + }
1.39 +
1.40 /**
1.41 * Tests if this connection is live.
1.42 *