1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-20 15:22:23 +03:00

patch from Vicktor to fix Numeric decimal digits in getColumns

This commit is contained in:
Dave Cramer
2002-03-05 02:14:08 +00:00
parent fef790cc03
commit 521017c5d0
2 changed files with 21 additions and 15 deletions

View File

@ -13,7 +13,7 @@ import org.postgresql.util.PSQLException;
/*
* This class provides information about the database as a whole.
*
* $Id: DatabaseMetaData.java,v 1.42 2002/02/22 02:40:09 davec Exp $
* $Id: DatabaseMetaData.java,v 1.43 2002/03/05 02:14:06 davec Exp $
*
* <p>Many of the methods here return lists of information in ResultSets. You
* can use the normal ResultSet methods such as getString and getInt to
@ -2017,14 +2017,17 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
// from the typmod value.
if (typname.equals("numeric") || typname.equals("decimal"))
{
int attypmod = r.getInt(8);
int attypmod = r.getInt(8) - VARHDRSZ;
tuple[8] =
Integer.toString((attypmod - VARHDRSZ) & 0xffff).getBytes();
Integer.toString(attypmod & 0xffff).getBytes();
tuple[9] =
Integer.toString( ( attypmod >> 16 ) & 0xffff ).getBytes();
}
else
{
tuple[8] = "0".getBytes();
tuple[9] = "10".getBytes(); // Num Prec Radix - assume decimal
tuple[9] = "10".getBytes(); // Num Prec Radix - assume decimal
}
tuple[10] = Integer.toString(nullFlag.equals("f") ?
java.sql.DatabaseMetaData.columnNullable :
java.sql.DatabaseMetaData.columnNoNulls).getBytes(); // Nullable