JDBC1 patch attached. I don't have a JDBC1 environment (that I know of)
so I haven't even compiled this... sorry :(
I also attach a very small patch to correct my email address in the JDBC
2 patch. Apply it or not, it's not important, I just noticed it.
Thanks again
Cheers
Mark
> I have applied the jdbc2 version. It would be nice to have a jdbc1
> version too. Thanks.
Index: org/postgresql/jdbc1/DatabaseMetaData.java
===================================================================
RCS file: /cvs/pgjdbc71/org/postgresql/jdbc1/DatabaseMetaData.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 DatabaseMetaData.java
--- org/postgresql/jdbc1/DatabaseMetaData.java 2001/10/04 05:01:32 1.1.1.1
+++ org/postgresql/jdbc1/DatabaseMetaData.java 2001/10/25 01:04:58
@@ -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. [EMAIL PROTECTED]
+ 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
Index: org/postgresql/jdbc2/DatabaseMetaData.java
===================================================================
RCS file: /cvs/pgjdbc71/org/postgresql/jdbc2/DatabaseMetaData.java,v
retrieving revision 1.2
diff -u -r1.2 DatabaseMetaData.java
--- org/postgresql/jdbc2/DatabaseMetaData.java 2001/10/23 09:44:30 1.2
+++ org/postgresql/jdbc2/DatabaseMetaData.java 2001/10/25 01:09:09
@@ -1935,7 +1935,7 @@
// 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. [EMAIL PROTECTED]
+ // from the typmod value. [EMAIL PROTECTED]
if (typname.equals("numeric") || typname.equals("decimal"))
{
int attypmod = r.getInt(8);
PGP signature