List:Commits« Previous MessageNext Message »
From:mmatthews Date:February 21 2008 2:52am
Subject:Connector/J commit: r6735 - in branches/branch_5_1: . src/com/mysql/jdbc
View as plain text  
Modified:
   branches/branch_5_1/CHANGES
   branches/branch_5_1/src/com/mysql/jdbc/DatabaseMetaData.java
   branches/branch_5_1/src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java
Log:
Reverted a change to DatabaseMetadata.getColumns() from 5.0, where
      getColumns() would report NULL for COLUMN_SIZE for TIME, DATE, DATETIME
      and TIMESTAMP types. It now reports the column size, in the 
      DatabaseMetadata implementations that use "SHOW" commands, and the 
      INFORMATION_SCHEMA.

Modified: branches/branch_5_1/CHANGES
===================================================================
--- branches/branch_5_1/CHANGES	2008-02-20 17:13:12 UTC (rev 6734)
+++ branches/branch_5_1/CHANGES	2008-02-21 02:52:52 UTC (rev 6735)
@@ -129,6 +129,12 @@
       to one, in an effort to make it easier to debug communications errors caused
       by network timeouts.
       
+    - Reverted a change to DatabaseMetadata.getColumns() from 5.0, where
+      getColumns() would report NULL for COLUMN_SIZE for TIME, DATE, DATETIME
+      and TIMESTAMP types. It now reports the column size, in the 
+      DatabaseMetadata implementations that use "SHOW" commands, and the 
+      INFORMATION_SCHEMA.
+      
 10-09-07 - Version 5.1.5
 
     - Released instead of 5.1.4 to pickup patch for BUG#31053

Modified: branches/branch_5_1/src/com/mysql/jdbc/DatabaseMetaData.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/DatabaseMetaData.java	2008-02-20 17:13:12 UTC (rev 6734)
+++ branches/branch_5_1/src/com/mysql/jdbc/DatabaseMetaData.java	2008-02-21 02:52:52 UTC (rev 6735)
@@ -343,18 +343,19 @@
 						"varchar")) {
 					this.columnSize = Constants.integerValueOf(255);
 				} else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
+					"timestamp")) {
+					this.columnSize = Constants.integerValueOf(19);
+				} else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
+					"datetime")) {
+					this.columnSize = Constants.integerValueOf(19);
+				} else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
 						"date")) {
-					this.columnSize = null;
+					this.columnSize = Constants.integerValueOf(10);
 				} else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
 						"time")) {
-					this.columnSize = null;
+					this.columnSize = Constants.integerValueOf(8);
+				
 				} else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
-						"timestamp")) {
-					this.columnSize = null;
-				} else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
-						"datetime")) {
-					this.columnSize = null;
-				} else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
 						"tinyblob")) {
 					this.columnSize = Constants.integerValueOf(255);
 				} else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,

Modified: branches/branch_5_1/src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java	2008-02-20 17:13:12 UTC (rev 6734)
+++ branches/branch_5_1/src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java	2008-02-21 02:52:52 UTC (rev 6735)
@@ -223,9 +223,8 @@
 		}
 
 		sqlBuf
-				.append("CASE WHEN CHARACTER_MAXIMUM_LENGTH IS NULL THEN NUMERIC_PRECISION ELSE CASE WHEN CHARACTER_MAXIMUM_LENGTH > " 
-						+ Integer.MAX_VALUE + " THEN " + Integer.MAX_VALUE + 
-						" ELSE CHARACTER_MAXIMUM_LENGTH END END AS COLUMN_SIZE, "
+				.append("CASE WHEN LCASE(DATA_TYPE)='date' THEN 10 WHEN LCASE(DATA_TYPE)='time' THEN 8 WHEN LCASE(DATA_TYPE)='datetime' THEN 19 WHEN LCASE(DATA_TYPE)='timestamp' THEN 19 WHEN CHARACTER_MAXIMUM_LENGTH IS NULL THEN NUMERIC_PRECISION WHEN CHARACTER_MAXIMUM_LENGTH > " 
+						+ Integer.MAX_VALUE + " THEN " + Integer.MAX_VALUE + " ELSE CHARACTER_MAXIMUM_LENGTH END AS COLUMN_SIZE, "
 						+ MysqlIO.getMaxBuf() + " AS BUFFER_LENGTH,"
 						+ "NUMERIC_SCALE AS DECIMAL_DIGITS,"
 						+ "10 AS NUM_PREC_RADIX,"

Thread
Connector/J commit: r6735 - in branches/branch_5_1: . src/com/mysql/jdbcmmatthews21 Feb