Re: Patches for ResultSetMetaData.java for Postgresql 7.1.3 (sorry,

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Ed Yu <ekyu(at)sc(dot)rr(dot)com>
Cc: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Patches for ResultSetMetaData.java for Postgresql 7.1.3 (sorry,
Date: 2002-01-21 05:05:20
Message-ID: 200201210505.g0L55Kk25296@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Saved for 7.3:

http://candle.pha.pa.us/cgi-bin/pgpatches2

---------------------------------------------------------------------------

Ed Yu wrote:
> This patch fixes the exception thrown to inform the user the method
> getColumnClassName(int) is not implemented. This will futher fixes method
> ResultSet.getObject(int) since it requires the getColumnClassName(int)
> method to return the proper java class used to map the database column.
>
> *** ResultSetMetaData.java.orig Mon Apr 17 16:07:51 2000
> --- ResultSetMetaData.java Mon Dec 17 22:26:24 2001
> ***************
> *** 448,454 ****
> --- 448,513 ----
> // This can hook into our PG_Object mechanism
> public String getColumnClassName(int column) throws SQLException
> {
> + /*
> + The following data type mapping came from ../Field.java.
> +
> + "int2",
> + "int4","oid",
> + "int8",
> + "cash","money",
> + "numeric",
> + "float4",
> + "float8",
> + "bpchar","char","char2","char4","char8","char16",
> + "varchar","text","name","filename",
> + "bool",
> + "date",
> + "time",
> + "abstime","timestamp"
> +
> + Types.SMALLINT,
> + Types.INTEGER,Types.INTEGER,
> + Types.BIGINT,
> + Types.DOUBLE,Types.DOUBLE,
> + Types.NUMERIC,
> + Types.REAL,
> + Types.DOUBLE,
> + Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,
> + Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,
> + Types.BIT,
> + Types.DATE,
> + Types.TIME,
> + Types.TIMESTAMP,Types.TIMESTAMP
> + */
> +
> + int sql_type = getField(column).getSQLType();
> +
> + switch (sql_type)
> + {
> + case Types.BIT:
> + return("java.lang.Boolean");
> + case Types.SMALLINT:
> + return("java.lang.Integer");
> + case Types.INTEGER:
> + return("java.lang.Integer");
> + case Types.BIGINT:
> + return("java.lang.Long");
> + case Types.NUMERIC:
> + return("java.math.BigDecimal");
> + case Types.REAL:
> + return("java.lang.Float");
> + case Types.DOUBLE:
> + return("java.lang.Double");
> + case Types.CHAR:
> + case Types.VARCHAR:
> + return("java.lang.String");
> + case Types.DATE:
> + case Types.TIME:
> + case Types.TIMESTAMP:
> + return("java.sql.Timestamp");
> + default:
> throw org.postgresql.Driver.notImplemented();
> + }
> }
>
> }
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Bruce Momjian 2002-01-21 05:08:20 Re: Patches for DatabaseMetaData.java for Postgresql 7.1.3 (sorry,
Previous Message Ned Wolpert 2002-01-19 16:05:52 Re: HELP: Error opening connection to dburl: jdbc:postgresql://localhost/test