[libpostgresql-jdbc-java] 03/08: setObject fails to identify the correct type of java.lang.Byte.
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:19:32 UTC 2017
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to tag REL8_0_320
in repository libpostgresql-jdbc-java.
commit 8880a9925ab846325cf7e401da3627d3b6aec255
Author: Kris Jurka <books at ejurka.com>
Date: Fri Jun 22 21:37:53 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 6d3241d..b8c59a1 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.68.2.12 2006/02/01 18:52:41 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v 1.68.2.13 2006/09/26 04:42:31 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1701,6 +1701,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 6b921ac..255ae18 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.5 2004/11/09 08:56:33 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc3/TypesTest.java,v 1.6 2005/01/11 08:25:49 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,6 +56,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