Modified:
branches/branch_5_0/connector-j/CHANGES
branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
Log:
Fixed BUG#28972, DatabaseMetaData.getTypeInfo() for the types DECIMAL
and NUMERIC will return a precision of 254 for server versions older than
5.0.3, 64 for versions 5.0.3-5.0.5 and 65 for versions newer than 5.0.5.
Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES 2007-08-30 15:52:01 UTC (rev 6533)
+++ branches/branch_5_0/connector-j/CHANGES 2007-08-30 20:46:47 UTC (rev 6534)
@@ -27,6 +27,10 @@
subqueries and functions were indistinguishable from each other,
leading to type-related bugs.
+ - Fixed BUG#28972, DatabaseMetaData.getTypeInfo() for the types DECIMAL
+ and NUMERIC will return a precision of 254 for server versions older than
+ 5.0.3, 64 for versions 5.0.3-5.0.5 and 65 for versions newer than 5.0.5.
+
07-19-07 - Version 5.0.7
- Setting the configuration parameter "useCursorFetch" to "true" for
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2007-08-30
15:52:01 UTC (rev 6533)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2007-08-30
20:46:47 UTC (rev 6534)
@@ -5606,6 +5606,18 @@
rowVal[17] = s2b("10"); // NUM_PREC_RADIX (2 or 10)
tuples.add(rowVal);
+ // The maximum number of digits for DECIMAL or NUMERIC is 65 (64 from MySQL 5.0.3 to
5.0.5).
+
+ int decimalPrecision = 254;
+
+ if (this.conn.versionMeetsMinimum(5,0,3)) {
+ if (this.conn.versionMeetsMinimum(5, 0, 6)) {
+ decimalPrecision = 65;
+ } else {
+ decimalPrecision = 64;
+ }
+ }
+
/*
* MySQL Type: NUMERIC (silently converted to DECIMAL) JDBC Type:
* NUMERIC
@@ -5615,7 +5627,7 @@
rowVal[1] = Integer.toString(java.sql.Types.NUMERIC).getBytes();
// JDBC Data type
- rowVal[2] = s2b("17"); // Precision
+ rowVal[2] = s2b(String.valueOf(decimalPrecision)); // Precision
rowVal[3] = s2b(""); // Literal Prefix
rowVal[4] = s2b(""); // Literal Suffix
rowVal[5] = s2b("[(M[,D])] [ZEROFILL]"); // Create Params
@@ -5647,7 +5659,7 @@
rowVal[1] = Integer.toString(java.sql.Types.DECIMAL).getBytes();
// JDBC Data type
- rowVal[2] = s2b("17"); // Precision
+ rowVal[2] = s2b(String.valueOf(decimalPrecision)); // Precision
rowVal[3] = s2b(""); // Literal Prefix
rowVal[4] = s2b(""); // Literal Suffix
rowVal[5] = s2b("[(M[,D])] [ZEROFILL]"); // Create Params
| Thread |
|---|
| • Connector/J commit: r6534 - in branches/branch_5_0/connector-j: . src/com/mysql/jdbc | mmatthews | 30 Aug |