Changeset: 17b8a0a84e62 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java/rev/17b8a0a84e62
Modified Files:
src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java
Branch: default
Log Message:
Call reader.read multiple times if necessary
diffs (18 lines):
diff --git a/src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java
b/src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java
--- a/src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java
+++ b/src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java
@@ -944,7 +944,13 @@ public class MonetPreparedStatement
// simply serialise the Reader data into a large buffer
final CharBuffer buf = CharBuffer.allocate((int)length); //
have to down cast
try {
- reader.read(buf);
+ long foo = 0;
+ while (foo < length) {
+ int n = reader.read(buf);
+ if (n < 0)
+ throw new SQLException("Stream ended
unexpectedly at position " + foo + " out of " + length);
+ foo += n;
+ }
// We have to rewind the buffer, because otherwise
toString() returns "".
buf.rewind();
setString(parameterIndex, buf.toString());
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]