Mercurial > hg > monetdb-java
comparison src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java @ 967:5cc071c5c170
Corrected the returned integer values of Statement methods executeUpdate(...), executeLargeUpdate(...), getUpdateCount() and getLargeUpdateCount() and PreparedStatement methods executeUpdate() and executeLargeUpdate(). They returned -2 for DDL statements, which was not in compliance with the JDBC API documentation.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 13 Feb 2025 21:16:20 +0100 (2 months ago) |
parents | ff075ed5ce81 |
children | 32f246853ec4 |
comparison
equal
deleted
inserted
replaced
966:39b74cc688d2 | 967:5cc071c5c170 |
---|---|
325 @Override | 325 @Override |
326 public int executeUpdate() throws SQLException { | 326 public int executeUpdate() throws SQLException { |
327 if (execute() != false) | 327 if (execute() != false) |
328 throw new SQLException("Query produced a result set", "M1M17"); | 328 throw new SQLException("Query produced a result set", "M1M17"); |
329 | 329 |
330 return getUpdateCount(); | 330 return Math.max(getUpdateCount(), 0); |
331 } | 331 } |
332 | 332 |
333 /** override the executeUpdate from the Statement to throw an SQLException */ | 333 /** override the executeUpdate from the Statement to throw an SQLException */ |
334 @Override | 334 @Override |
335 public int executeUpdate(final String q) throws SQLException { | 335 public int executeUpdate(final String q) throws SQLException { |
2261 @Override | 2261 @Override |
2262 public long executeLargeUpdate() throws SQLException { | 2262 public long executeLargeUpdate() throws SQLException { |
2263 if (execute() != false) | 2263 if (execute() != false) |
2264 throw new SQLException("Query produced a result set", "M1M17"); | 2264 throw new SQLException("Query produced a result set", "M1M17"); |
2265 | 2265 |
2266 return getLargeUpdateCount(); | 2266 return Math.max(getLargeUpdateCount(), 0L); |
2267 } | 2267 } |
2268 | 2268 |
2269 //== end methods interface PreparedStatement | 2269 //== end methods interface PreparedStatement |
2270 | 2270 |
2271 | 2271 |