diff 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
line wrap: on
line diff
--- a/src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java
+++ b/src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java
@@ -327,7 +327,7 @@ public class MonetPreparedStatement
 		if (execute() != false)
 			throw new SQLException("Query produced a result set", "M1M17");
 
-		return getUpdateCount();
+		return Math.max(getUpdateCount(), 0);
 	}
 
 	/** override the executeUpdate from the Statement to throw an SQLException */
@@ -2263,7 +2263,7 @@ public class MonetPreparedStatement
 		if (execute() != false)
 			throw new SQLException("Query produced a result set", "M1M17");
 
-		return getLargeUpdateCount();
+		return Math.max(getLargeUpdateCount(), 0L);
 	}
 
 	//== end methods interface PreparedStatement