# HG changeset patch
# User Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
# Date 1601053571 -7200
# Node ID 02f353f62abe99ddacf8a66779e6fc7888569927
# Parent  8a813f5cef1b117864a3bef862b482eb05ff4542
Adjust UpdateResponse to allow for large updates (long instead of int).
Also change getLargeUpdateCount() to use this long count.

diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
@@ -2601,10 +2601,10 @@ public class MonetConnection
 	 */
 	// {{{ UpdateResponse class implementation
 	final static class UpdateResponse implements Response {
-		public final int count;
+		public final long count;
 		public final String lastid;
 
-		public UpdateResponse(final int cnt, final String id) {
+		public UpdateResponse(final long cnt, final String id) {
 			// fill the blank finals
 			this.count = cnt;
 			this.lastid = id;
@@ -2902,7 +2902,7 @@ public class MonetConnection
 									}
 								} break;
 								case StartOfHeaderParser.Q_UPDATE:
-									res = new UpdateResponse(sohp.getNextAsInt(),   // count
+									res = new UpdateResponse(sohp.getNextAsLong(),   // count
 												 sohp.getNextAsString() // key-id
 												);
 									break;
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetStatement.java b/src/main/java/nl/cwi/monetdb/jdbc/MonetStatement.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetStatement.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetStatement.java
@@ -929,16 +929,10 @@ public class MonetStatement
 	 */
 	@Override
 	public int getUpdateCount() throws SQLException {
-		int ret = -1;
-		if (header != null) {
-			if (header instanceof MonetConnection.UpdateResponse) {
-				ret = ((MonetConnection.UpdateResponse)header).count;
-			} else if (header instanceof MonetConnection.SchemaResponse) {
-				ret = ((MonetConnection.SchemaResponse)header).state;
-			}
-		}
-
-		return ret;
+		long ret = getLargeUpdateCount();
+		if (ret >= Integer.MAX_VALUE)
+			return Integer.MAX_VALUE;
+		return (int)ret;
 	}
 
 	/**
@@ -1218,7 +1212,16 @@ public class MonetStatement
 	 *	method is called on a closed Statement
 	 */
 	public long getLargeUpdateCount() throws SQLException {
-		return getUpdateCount();
+		long ret = -1;
+		if (header != null) {
+			if (header instanceof MonetConnection.UpdateResponse) {
+				ret = ((MonetConnection.UpdateResponse)header).count;
+			} else if (header instanceof MonetConnection.SchemaResponse) {
+				ret = ((MonetConnection.SchemaResponse)header).state;
+			}
+		}
+
+		return ret;
 	}
 
 	/**