Re: getScale() and getPrecision() patch

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: David Esposito <esposito(at)newnetco(dot)com>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, PostgreSQL jdbc list <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: getScale() and getPrecision() patch
Date: 2001-05-16 17:08:08
Message-ID: 200105161708.f4GH88917255@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-patches


Patch applied to jdbc1 and jdbc2 and attached. This adds NUMERIC tests
to the code.

> ahh ... or maybe a "diff -c" ... amazing what the man pages can teach you ..
> ;)
>
> [root(at)TIMDA1 postgresbugfix]# diff -c ResultSetMetaData.java-original
> ResultSetMetaData.java
> *** ResultSetMetaData.java-original Mon Apr 17 16:07:52 2000
> --- ResultSetMetaData.java Wed May 2 17:29:36 2001
> ***************
> *** 285,290 ****
> --- 285,296 ----
> return 16;
> case Types.VARCHAR:
> return 0;
> + case Types.NUMERIC:
> + Field f = getField(column);
> + if(f != null)
> + return ((0xFFFF0000)&f.mod)>>16;
> + else
> + return 0;
> default:
> return 0;
> }
> ***************
> *** 316,321 ****
> --- 322,333 ----
> return 16;
> case Types.VARCHAR:
> return 0;
> + case Types.NUMERIC:
> + Field f = getField(column);
> + if(f != null)
> + return (((0x0000FFFF)&f.mod)-4);
> + else
> + return 0;
> default:
> return 0;
> }
> [root(at)TIMDA1 postgresbugfix]#
>
> > -----Original Message-----
> > From: Bruce Momjian [mailto:pgman(at)candle(dot)pha(dot)pa(dot)us]
> > Sent: Tuesday, May 08, 2001 1:17 PM
> > To: David Esposito
> > Cc: pgsql-jdbc(at)postgresql(dot)org
> > Subject: Re: [JDBC] getScale() and getPrecision() patch
> >
> >
> >
> > Is it possible to get a context diff of this patch? Thanks.
> >
> >
> > [ Charset ISO-8859-1 unsupported, converting... ]
> > > With a little bit of hacking, I figured out the internal
> > representation that
> > > PostGreSQL uses for its precision and scale values ... here's
> > the diff for
> > > the patch:
> > >
> > >
> > \postgresql-7.1\src\interfaces\jdbc\org\postgresql\jdbc2\ResultSet
> > MetaData.j
> > > ava
> > >
> > > [root(at)TIMDA1 postgresbugfix]# diff ResultSetMetaData.java
> > > ResultSetMetaData.java-original
> > > 288,293d287
> > > < case Types.NUMERIC:
> > > < Field f = getField(column);
> > > < if(f != null)
> > > < return ((0xFFFF0000)&f.mod)>>16;
> > > < else
> > > < return 0;
> > > 325,330d318
> > > < case Types.NUMERIC:
> > > < Field f = getField(column);
> > > < if(f != null)
> > > < return (((0x0000FFFF)&f.mod)-4);
> > > < else
> > > < return 0;
> > > [root(at)TIMDA1 postgresbugfix]#
> > >
>
>

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

Attachment Content-Type Size
unknown_filename text/plain 3.5 KB

Browse pgsql-jdbc by date

  From Date Subject
Next Message Bruce Momjian 2001-05-16 17:21:31 Re: Another patch
Previous Message Mark D. Apolinski 2001-05-16 17:07:46 Help: Postgresql/JDBC database access error

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-05-16 17:46:14 Re: DatabaseMetaData.getIndexInfo() added
Previous Message Bruce Momjian 2001-05-16 16:19:31 Re: Patch to add cursor support to PL/pgSQL