Re: getScale() and getPrecision() patch

Started by Bruce Momjianabout 25 years ago1 messagespatches
Jump to latest
#1Bruce Momjian
bruce@momjian.us

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@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@TIMDA1 postgresbugfix]#

-----Original Message-----
From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
Sent: Tuesday, May 08, 2001 1:17 PM
To: David Esposito
Cc: pgsql-jdbc@postgresql.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@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@TIMDA1 postgresbugfix]#

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

Attachments:

/bjm/difftext/plainDownload+27-2