Mercurial > hg > monetdb-java
changeset 378:02f353f62abe
Adjust UpdateResponse to allow for large updates (long instead of int).
Also change getLargeUpdateCount() to use this long count.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Fri, 25 Sep 2020 19:06:11 +0200 (2020-09-25) |
parents | 8a813f5cef1b |
children | d7661075ebf7 |
files | src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java src/main/java/nl/cwi/monetdb/jdbc/MonetStatement.java |
diffstat | 2 files changed, 17 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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; } /**