nizhikov commented on code in PR #11518:
URL: https://github.com/apache/ignite/pull/11518#discussion_r1828925861


##########
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 {

Review Comment:
   no reason for new line for throws 



##########
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);
+
+            if (len != written)
+                throw new BinaryObjectException("Input stream length mismatch. 
[declaredLength=" + len + ", " +
+                        "actualLength=" + written + "]");
+        }
+    }
+
+    /**
+     * Write byte array from the Blob instance.
+     *
+     * @param writer Writer.
+     * @param blob Blob.
+     */
+    private static void writeBlobAsByteArray(BinaryWriterExImpl writer, Blob 
blob)
+            throws BinaryObjectException {

Review Comment:
   no reason for new line for throws 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to