[libpostgresql-jdbc-java] 09/14: Applying HEAD changes to stable branch:
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:19:13 UTC 2017
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to tag REL8_0_312
in repository libpostgresql-jdbc-java.
commit 737772e7c160c4c06e322c028f15a5741604d49a
Author: Oliver Jowett <oliver at opencloud.com>
Date: Wed Jun 8 01:48:15 2005 +0000
Applying HEAD changes to stable branch:
Fix ResultSet.getObject(..., Types.SMALLINT) to return an Integer per the JDBC3 typemapping appendix.
Reported by Kevin Grittner <Kevin.Grittner at wicourts.gov>.
Add support for several more types to ResultSet.getObject: BOOLEAN, TINYINT, DECIMAL, LONGVARCHAR, LONGVARBINARY, CLOB, BLOB
---
org/postgresql/jdbc2/AbstractJdbc2ResultSet.java | 15 ++++++++++++---
org/postgresql/jdbc3/AbstractJdbc3ResultSet.java | 13 ++++++++++++-
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java b/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
index 1199dda..8bc379d 100644
--- a/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
+++ b/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
@@ -3,7 +3,7 @@
* Copyright (c) 2003-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java,v 1.71.2.2 2005/03/23 19:48:17 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java,v 1.71.2.3 2005/05/08 23:52:00 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -113,22 +113,26 @@ public abstract class AbstractJdbc2ResultSet implements BaseResultSet, org.postg
switch (getSQLType(columnIndex))
{
case Types.BIT:
+ // Also Types.BOOLEAN in JDBC3
return getBoolean(columnIndex) ? Boolean.TRUE : Boolean.FALSE;
+ case Types.TINYINT:
case Types.SMALLINT:
- return new Short(getShort(columnIndex));
case Types.INTEGER:
return new Integer(getInt(columnIndex));
case Types.BIGINT:
return new Long(getLong(columnIndex));
case Types.NUMERIC:
+ case Types.DECIMAL:
return getBigDecimal
(columnIndex, (field.getMod() == -1) ? -1 : ((field.getMod() - 4) & 0xffff));
case Types.REAL:
return new Float(getFloat(columnIndex));
+ case Types.FLOAT:
case Types.DOUBLE:
return new Double(getDouble(columnIndex));
case Types.CHAR:
case Types.VARCHAR:
+ case Types.LONGVARCHAR:
return getString(columnIndex);
case Types.DATE:
return getDate(columnIndex);
@@ -138,9 +142,14 @@ public abstract class AbstractJdbc2ResultSet implements BaseResultSet, org.postg
return getTimestamp(columnIndex);
case Types.BINARY:
case Types.VARBINARY:
+ case Types.LONGVARBINARY:
return getBytes(columnIndex);
case Types.ARRAY:
return getArray(columnIndex);
+ case Types.CLOB:
+ return getClob(columnIndex);
+ case Types.BLOB:
+ return getBlob(columnIndex);
default:
String type = getPGType(columnIndex);
@@ -168,7 +177,7 @@ public abstract class AbstractJdbc2ResultSet implements BaseResultSet, org.postg
return rs;
}
- // Caller determines what to do (JDBC2 overrides in this case)
+ // Caller determines what to do (JDBC3 overrides in this case)
return null;
}
}
diff --git a/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java b/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java
index dd35880..4c06a3d 100644
--- a/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java
+++ b/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java
@@ -3,7 +3,7 @@
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java,v 1.11 2005/01/11 08:25:46 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java,v 1.11.2.1 2005/02/15 08:55:51 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,6 +29,17 @@ public abstract class AbstractJdbc3ResultSet extends org.postgresql.jdbc2.Abstra
super (originalQuery, statement, fields, tuples, cursor, maxRows, maxFieldSize, rsType, rsConcurrency);
}
+ // Overrides JDBC2 version to support Types.BOOLEAN.
+ protected Object internalGetObject(int columnIndex, Field field) throws SQLException
+ {
+ switch (getSQLType(columnIndex)) {
+ case Types.BOOLEAN:
+ return new Boolean(getBoolean(columnIndex));
+ default:
+ return super.internalGetObject(columnIndex, field);
+ }
+ }
+
/**
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as a <code>java.net.URL</code>
--
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