Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d80d4ba

Browse files
author
Barry Lind
committed
applied patch from Mark Lillywhite, patch was already applied to jdbc2, this applies same fix to jdbc1 code
1 parent cd01c32 commit d80d4ba

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* This class provides information about the database as a whole.
1515
*
16-
* $Id: DatabaseMetaData.java,v 1.35 2001/10/25 05:59:59 momjian Exp $
16+
* $Id: DatabaseMetaData.java,v 1.36 2001/10/30 05:05:25 barry Exp $
1717
*
1818
* <p>Many of the methods here return lists of information in ResultSets. You
1919
* can use the normal ResultSet methods such as getString and getInt to
@@ -2011,7 +2011,19 @@ public java.sql.ResultSet getColumns(String catalog, String schemaPattern, Strin
20112011
}
20122012

20132013
tuple[7] = null; // Buffer length
2014-
tuple[8] = "0".getBytes(); // Decimal Digits - how to get this?
2014+
// Decimal digits = scale
2015+
// From the source (see e.g. backend/utils/adt/numeric.c,
2016+
// function numeric()) the scale and precision can be calculated
2017+
// from the typmod value.
2018+
if (typname.equals("numeric") || typname.equals("decimal"))
2019+
{
2020+
int attypmod = r.getInt(8);
2021+
tuple[8] =
2022+
Integer.toString((attypmod - VARHDRSZ) & 0xffff).getBytes();
2023+
}
2024+
else
2025+
tuple[8] = "0".getBytes();
2026+
20152027
tuple[9] = "10".getBytes(); // Num Prec Radix - assume decimal
20162028
tuple[10] = Integer.toString(nullFlag.equals("f") ?
20172029
java.sql.DatabaseMetaData.columnNullable :

0 commit comments

Comments
 (0)