|
13 | 13 | /**
|
14 | 14 | * This class provides information about the database as a whole.
|
15 | 15 | *
|
16 |
| - * $Id: DatabaseMetaData.java,v 1.38 2001/10/2404:31:50 barry Exp $ |
| 16 | + * $Id: DatabaseMetaData.java,v 1.39 2001/10/2417:44:28 momjian Exp $ |
17 | 17 | *
|
18 | 18 | * <p>Many of the methods here return lists of information in ResultSets. You
|
19 | 19 | * can use the normal ResultSet methods such as getString and getInt to
|
@@ -1999,7 +1999,18 @@ public java.sql.ResultSet getColumns(String catalog, String schemaPattern, Strin
|
1999 | 1999 | }
|
2000 | 2000 |
|
2001 | 2001 | tuple[7] =null;// Buffer length
|
2002 |
| -tuple[8] ="0".getBytes();// Decimal Digits - how to get this? |
| 2002 | +// Decimal digits = scale |
| 2003 | +// From the source (see e.g. backend/utils/adt/numeric.c, |
| 2004 | +// function numeric()) the scale and precision can be calculated |
| 2005 | +// from the typmod value. mark@plasticsoftware.com.au |
| 2006 | +if (typname.equals("numeric") ||typname.equals("decimal")) |
| 2007 | + { |
| 2008 | +intattypmod =r.getInt(8); |
| 2009 | +tuple[8] = |
| 2010 | +Integer.toString((attypmod &0xffff) -VARHDRSZ).getBytes(); |
| 2011 | + } |
| 2012 | +else |
| 2013 | +tuple[8] ="0".getBytes(); |
2003 | 2014 | tuple[9] ="10".getBytes();// Num Prec Radix - assume decimal
|
2004 | 2015 | tuple[10] =Integer.toString(nullFlag.equals("f") ?
|
2005 | 2016 | java.sql.DatabaseMetaData.columnNullable :
|
|