Changeset: 02f353f62abe for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=02f353f62abe
Modified Files:
src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
src/main/java/nl/cwi/monetdb/jdbc/MonetStatement.java
Branch: default
Log Message:
Adjust UpdateResponse to allow for large updates (long instead of int).
Also change getLargeUpdateCount() to use this long count.
diffs (67 lines):
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;
}
/**
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list