nizhikov commented on code in PR #11518: URL: https://github.com/apache/ignite/pull/11518#discussion_r1828917999
########## modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerUtils.java: ########## @@ -246,12 +274,61 @@ else if (cls == Timestamp[].class) writer.writeTimestampArray((Timestamp[])obj); else if (cls == java.util.Date[].class || cls == java.sql.Date[].class) writer.writeDateArray((java.util.Date[])obj); + else if (obj instanceof SqlInputStreamWrapper) + writeInputStreamAsByteArray(writer, (SqlInputStreamWrapper)obj); + else if (obj instanceof Blob) + writeBlobAsByteArray(writer, (Blob)obj); else if (binObjAllow) writer.writeObjectDetached(obj); else throw new BinaryObjectException("Custom objects are not supported"); } + /** + * Write byte array from the InputStream enclosed in the stream wrapper. + * + * @param writer Writer. + * @param wrapper stream wrapper + */ + private static void writeInputStreamAsByteArray(BinaryWriterExImpl writer, SqlInputStreamWrapper wrapper) + throws BinaryObjectException { + InputStream in = wrapper.getInputStream(); + Integer len = wrapper.getLength(); + + if (len == null) + writer.writeByteArrayFromInputStream(in); Review Comment: writeByteArrayFromInputStream -> `writeByteArray` or just `write` ########## modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerUtils.java: ########## @@ -246,12 +274,61 @@ else if (cls == Timestamp[].class) writer.writeTimestampArray((Timestamp[])obj); else if (cls == java.util.Date[].class || cls == java.sql.Date[].class) writer.writeDateArray((java.util.Date[])obj); + else if (obj instanceof SqlInputStreamWrapper) + writeInputStreamAsByteArray(writer, (SqlInputStreamWrapper)obj); + else if (obj instanceof Blob) + writeBlobAsByteArray(writer, (Blob)obj); else if (binObjAllow) writer.writeObjectDetached(obj); else throw new BinaryObjectException("Custom objects are not supported"); } + /** + * Write byte array from the InputStream enclosed in the stream wrapper. + * + * @param writer Writer. + * @param wrapper stream wrapper + */ + private static void writeInputStreamAsByteArray(BinaryWriterExImpl writer, SqlInputStreamWrapper wrapper) + throws BinaryObjectException { + InputStream in = wrapper.getInputStream(); + Integer len = wrapper.getLength(); + + if (len == null) + writer.writeByteArrayFromInputStream(in); + else { + int written = writer.writeByteArrayFromInputStream(in, len); Review Comment: writeByteArrayFromInputStream -> writeByteArray or just write -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org