src/Pure/General/sql.scala
changeset 80357 fe123d033e76
parent 80083 e2174bf626b8
child 80441 c420429fdf4c
--- a/src/Pure/General/sql.scala	Tue Jun 11 16:48:20 2024 +0200
+++ b/src/Pure/General/sql.scala	Tue Jun 11 21:32:26 2024 +0200
@@ -329,7 +329,8 @@
     object bytes {
       def update(i: Int, bytes: Bytes): Unit = {
         if (bytes == null) rep.setBytes(i, null)
-        else rep.setBinaryStream(i, bytes.stream(), bytes.length)
+        else if (bytes.size > Int.MaxValue) throw new IllegalArgumentException
+        else rep.setBinaryStream(i, bytes.stream(), bytes.size.toInt)
       }
       def update(i: Int, bytes: Option[Bytes]): Unit = update(i, bytes.orNull)
     }