[libpostgresql-jdbc-java] 05/13: setObject fails to identify the correct type of java.lang.Byte.

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


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

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

commit baeb5ba3191955bd6461649c61588077a5e5fb25
Author: Kris Jurka <books at ejurka.com>
Date:   Fri Jun 22 21:37:47 2007 +0000

    setObject fails to identify the correct type of java.lang.Byte.
    
    Boom Roos
---
 org/postgresql/jdbc2/AbstractJdbc2Statement.java |  4 +++-
 org/postgresql/test/jdbc3/TypesTest.java         | 16 +++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/org/postgresql/jdbc2/AbstractJdbc2Statement.java b/org/postgresql/jdbc2/AbstractJdbc2Statement.java
index 94133a1..47b15b0 100644
--- a/org/postgresql/jdbc2/AbstractJdbc2Statement.java
+++ b/org/postgresql/jdbc2/AbstractJdbc2Statement.java
@@ -3,7 +3,7 @@
 * Copyright (c) 2004-2005, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
-*   $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v 1.84.2.9 2007/02/19 06:05:01 jurka Exp $
+*   $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v 1.84.2.10 2007/03/29 04:28:02 jurka Exp $
 *
 *-------------------------------------------------------------------------
 */
@@ -1718,6 +1718,8 @@ public abstract class AbstractJdbc2Statement implements BaseStatement
             setTimestamp(parameterIndex, (Timestamp)x);
         else if (x instanceof Boolean)
             setBoolean(parameterIndex, ((Boolean)x).booleanValue());
+        else if (x instanceof Byte)
+            setByte(parameterIndex, ((Byte)x).byteValue());
         else if (x instanceof Blob)
             setBlob(parameterIndex, (Blob)x);
         else if (x instanceof Clob)
diff --git a/org/postgresql/test/jdbc3/TypesTest.java b/org/postgresql/test/jdbc3/TypesTest.java
index 80c1481..b67b11a 100644
--- a/org/postgresql/test/jdbc3/TypesTest.java
+++ b/org/postgresql/test/jdbc3/TypesTest.java
@@ -3,7 +3,7 @@
 * Copyright (c) 2004-2005, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
-*   $PostgreSQL: pgjdbc/org/postgresql/test/jdbc3/TypesTest.java,v 1.6 2005/01/11 08:25:49 jurka Exp $
+*   $PostgreSQL: pgjdbc/org/postgresql/test/jdbc3/TypesTest.java,v 1.7 2005/07/04 18:50:30 davec Exp $
 *
 *-------------------------------------------------------------------------
 */
@@ -64,6 +64,20 @@ public class TypesTest extends TestCase {
         }
     }
 
+    public void testPreparedByte() throws SQLException {
+        PreparedStatement pstmt = _conn.prepareStatement("SELECT ?,?");
+        pstmt.setByte(1, (byte)1);
+        pstmt.setObject(2, Byte.valueOf((byte)2));
+        ResultSet rs = pstmt.executeQuery();
+        assertTrue(rs.next());
+        assertEquals((byte)1, rs.getByte(1));
+        assertFalse(rs.wasNull());
+        assertEquals((byte)2, rs.getByte(2));
+        assertFalse(rs.wasNull());
+        rs.close();
+        pstmt.close();
+    }
+
     public void testCallableBoolean() throws SQLException {
         CallableStatement cs = _conn.prepareCall("{? = call return_bool(?)}");
         cs.registerOutParameter(1, Types.BOOLEAN);

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