From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | pgman(at)candle(dot)pha(dot)pa(dot)us |
Cc: | Mark Lillywhite <mark(at)inomial(dot)com>, PostgreSQL jdbc list <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: [PATCHES] DatabaseMetadata patch |
Date: | 2001-10-24 17:46:48 |
Message-ID: | 200110241746.f9OHkmw03501@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Patch applied. Thanks. If you can send a jdbc1 version, that would be
great.
---------------------------------------------------------------------------
> Here is a patch for DatabaseMetaData to show precision properly. It is
> from Mark Lillywhite. I am adding to the patch queue.
>
> --
> 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
> Index: org/postgresql/jdbc2/DatabaseMetaData.java
> ===================================================================
> RCS file: /cvs/pgjdbc71/org/postgresql/jdbc2/DatabaseMetaData.java,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- org/postgresql/jdbc2/DatabaseMetaData.java 2001/10/04 05:01:32 1.1
> +++ org/postgresql/jdbc2/DatabaseMetaData.java 2001/10/23 09:44:30 1.2
> @@ -1932,7 +1932,19 @@
>
> tuple[7] = null; // Buffer length
>
> - tuple[8] = "0".getBytes(); // Decimal Digits - how to get this?
> + // Decimal digits = scale
> + // From the source (see e.g. backend/utils/adt/numeric.c,
> + // function numeric()) the scale and precision can be calculated
> + // from the typmod value. mark(at)plasticsoftware(dot)com(dot)au
> + if (typname.equals("numeric") || typname.equals("decimal"))
> + {
> + int attypmod = r.getInt(8);
> + tuple[8] =
> + Integer.toString((attypmod & 0xffff) - VARHDRSZ).getBytes();
> + }
> + else
> + tuple[8] = "0".getBytes();
> +
> tuple[9] = "10".getBytes(); // Num Prec Radix - assume decimal
>
> // tuple[10] is below
--
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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-10-24 17:48:47 | Re: [PATCHES] DatabaseMetadata patch |
Previous Message | Barry Lind | 2001-10-24 16:48:51 | Re: [PATCHES] DatabaseMetadata patch |