From: | "David Esposito" <esposito(at)newnetco(dot)com> |
---|---|
To: | <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | getScale() and getPrecision() patch |
Date: | 2001-05-02 21:53:37 |
Message-ID: | PEEDKNLDICKECFBNGNLLIEIDCBAA.esposito@newnetco.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Jerry Reid | 2001-05-03 05:11:09 | Unable to store SHA hash |
Previous Message | David Esposito | 2001-05-02 16:55:20 | getScale() and getPrecision() |