List:Commits« Previous MessageNext Message »
From:mmatthews Date:February 13 2007 9:25pm
Subject:Connector/J commit: r6318 - branches/branch_5_0/connector-j trunk/connector-j trunk/connector-j/src/com/mysql/jdbc
View as plain text  
Modified:
   branches/branch_5_0/connector-j/CHANGES
   trunk/connector-j/CHANGES
   trunk/connector-j/src/com/mysql/jdbc/PreparedStatement.java
Log:
Fixed BUG#25787 - java.util.Date should be serialized for  PreparedStatement.setObject(). 
	  
We've added a new configuration option "treatUtilDateAsTimestamp", which is  false by
default, 
as (1) We already had specific behavior to treat java.util.Date as a java.sql.Timestamp
because 
it's useful to many folks, and (2) that behavior will very likely be required for drivers
JDBC-post-4.0.

(this commit also fixes a missed merge of the above patch in 5.1).
	  

Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES	2007-02-13 18:55:45 UTC (rev 6317)
+++ branches/branch_5_0/connector-j/CHANGES	2007-02-13 20:25:19 UTC (rev 6318)
@@ -144,7 +144,15 @@
 	  correctly named mutator/accessor, causing data source implementations that
 	  use JavaBean naming conventions to set properties to fail to set the property
 	  (and in the case of SJAS, fail silently when trying to set this parameter).
+	
+	- Fixed BUG#25787 - java.util.Date should be serialized for 
+	  PreparedStatement.setObject(). 
 	  
+	  We've added a new configuration option "treatUtilDateAsTimestamp", which is 
+	  false by default, as (1) We already had specific behavior to treat 
+	  java.util.Date as a java.sql.Timestamp because it's useful to many folks, 
+	  and (2) that behavior will very likely be required for drivers JDBC-post-4.0.
+	  
 10-20-06 - Version 5.0.4
 
     - Fixed BUG#21379 - column names don't match metadata in cases 

Modified: trunk/connector-j/CHANGES
===================================================================
--- trunk/connector-j/CHANGES	2007-02-13 18:55:45 UTC (rev 6317)
+++ trunk/connector-j/CHANGES	2007-02-13 20:25:19 UTC (rev 6318)
@@ -144,7 +144,15 @@
 	  correctly named mutator/accessor, causing data source implementations that
 	  use JavaBean naming conventions to set properties to fail to set the property
 	  (and in the case of SJAS, fail silently when trying to set this parameter).
-	  	  
+	  
+	- Fixed BUG#25787 - java.util.Date should be serialized for 
+	  PreparedStatement.setObject(). 
+	  
+	  We've added a new configuration option "treatUtilDateAsTimestamp", which is 
+	  false by default, as (1) We already had specific behavior to treat 
+	  java.util.Date as a java.sql.Timestamp because it's useful to many folks, 
+	  and (2) that behavior will very likely be required for drivers JDBC-post-4.0.
+	  	  	  
 10-20-06 - Version 5.0.4
 
     - Fixed BUG#21379 - column names don't match metadata in cases 

Modified: trunk/connector-j/src/com/mysql/jdbc/PreparedStatement.java
===================================================================
--- trunk/connector-j/src/com/mysql/jdbc/PreparedStatement.java	2007-02-13 18:55:45 UTC
(rev 6317)
+++ trunk/connector-j/src/com/mysql/jdbc/PreparedStatement.java	2007-02-13 20:25:19 UTC
(rev 6318)
@@ -3015,9 +3015,10 @@
 				setBlob(parameterIndex, (java.sql.Blob) parameterObj);
 			} else if (parameterObj instanceof java.sql.Clob) {
 				setClob(parameterIndex, (java.sql.Clob) parameterObj);
-			} else if (parameterObj instanceof java.util.Date) {
+			} else if (this.connection.getTreatUtilDateAsTimestamp() && 
+				parameterObj instanceof java.util.Date) {
 				setTimestamp(parameterIndex, new Timestamp(
-						((java.util.Date) parameterObj).getTime()));
+				((java.util.Date) parameterObj).getTime()));
 			} else if (parameterObj instanceof BigInteger) {
 				setString(parameterIndex, parameterObj.toString());
 			} else {

Thread
Connector/J commit: r6318 - branches/branch_5_0/connector-j trunk/connector-j trunk/connector-j/src/com/mysql/jdbcmmatthews13 Feb