Skip site navigation (1) Skip section navigation (2)

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: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: getScale() and getPrecision() patch
Date: 2001-05-08 17:17:29
Message-ID: 200105081717.f48HHTK15630@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-jdbc
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\ResultSetMetaData.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]#
> 
> 
> 
> > -----Original Message-----
> > From: pgsql-jdbc-owner(at)postgresql(dot)org
> > [mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of David Esposito
> > Sent: Wednesday, May 02, 2001 12:55 PM
> > To: pgsql-jdbc(at)postgresql(dot)org
> > Subject: [JDBC] getScale() and getPrecision()
> >
> >
> > Is there a reason that getScale() and getPrecision() both return zero for
> > NUMERIC fields? It seems like this shouldn't be the case. In the example
> > fields below (generated by doing a \d on the table), it would
> > seem like the
> > getScale and Precision methods should return the numbers contained in the
> > parentheses.
> >
> > Or at least that's how the docs seem to read and that's how Oracle does it
> > too ... ;)
> >
> >  catalog_item_id                | numeric(11,0)            | not null
> >  catalog_item_category_id       | numeric(11,0)            | not null
> >  catalog_item_manufacturer_no   | character varying(20)    |
> >  catalog_item_manufacturer_url  | character varying(50)    |
> >  catalog_item_retail_price      | numeric(11,2)            | not null
> >  catalog_item_member_price      | numeric(11,2)            | not null
> >  catalog_item_sellable          | numeric(1,0)             | not null
> >
> > -Dave
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://www.postgresql.org/search.mpl
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
> 

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

pgsql-jdbc by date

Next:From: Bruce MomjianDate: 2001-05-08 17:29:52
Subject: Re: [JDBC] Re: Trouble with JDBC2 ResultSet.getDate()
Previous:From: Bruce MomjianDate: 2001-05-08 16:44:24
Subject: Re: [JDBC] Re: Trouble with JDBC2 ResultSet.getDate()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group