[libpostgresql-jdbc-java] 07/09: In a binary data example: File.length() returns long, but PreparedStatement.setBinaryStream() wants an int.

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:19:11 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to tag REL8_0_311
in repository libpostgresql-jdbc-java.

commit 9402da5ce1410c89b640c93c41867136c0ee28c2
Author: Kris Jurka <books at ejurka.com>
Date:   Sun Apr 10 15:15:32 2005 +0000

    In a binary data example: File.length() returns long, but
    PreparedStatement.setBinaryStream() wants an int.
    
    From lluad in #postgresql.
---
 doc/pgjdbc.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/pgjdbc.xml b/doc/pgjdbc.xml
index 41b4fc7..73beaac 100644
--- a/doc/pgjdbc.xml
+++ b/doc/pgjdbc.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
   Copyright (c) 2004-2005, PostgreSQL Global Development Group
-  $PostgreSQL: pgjdbc/doc/pgjdbc.xml,v 1.22 2005/01/30 11:04:54 jurka Exp $
+  $PostgreSQL: pgjdbc/doc/pgjdbc.xml,v 1.22.2.1 2005/02/02 20:06:11 jurka Exp $
 -->
 
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
@@ -1311,7 +1311,7 @@ File file = new File("myimage.gif");
 FileInputStream fis = new FileInputStream(file);
 PreparedStatement ps = conn.prepareStatement("INSERT INTO images VALUES (?, ?)");
 ps.setString(1, file.getName());
-ps.setBinaryStream(2, fis, file.length());
+ps.setBinaryStream(2, fis, (int)file.length());
 ps.executeUpdate();
 ps.close();
 fis.close();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git



More information about the pkg-java-commits mailing list