Mantis - Quercus
Viewing Issue Advanced Details
2609 minor always 04-16-08 14:31 05-14-08 15:11
sgraf  
ferg  
normal  
closed 3.1.5  
fixed  
none    
none 3.2.0  
0002609: [MySQL] assigning empty value to datetime column silently fails
Assigning a empty value '' to a datetime colum will silently ignore the query.

To reproduce:
mysqli_query($db_link, "CREATE TABLE a (id int(10), dt datetime default NULL)");
mysqli_query($db_link, "INSERT INTO a VALUES(1, now()),(2, now()), (3, now())");

mysqli_query($db_link, "UPDATE a SET dt = '' WHERE id = 1"); // Query will be ignored, dt will remain at its original value.
mysqli_query($db_link, "UPDATE a SET dt = NULL WHERE id = 2"); // This works as expected
mysqli_query($db_link, "UPDATE a SET dt = '0000-00-00 00:00:00' WHERE id = 3"); // This works as excpected


Expected result for the query "UPDATE a SET dt = ''"

Updating with an empty value should set the datetime column to 0000-00-00 00:00:00.


Notes
(0003010)
nam   
04-24-08 16:53   
MySQL JDBC Drivers: 3.1.14, 5.1.6
MySQL Server: 5.0.51a Community WinXP

Issue not seen. The problem most likely is not from Resin/Quercus because Resin/Quercus just passes them along to your JDBC driver/database. The JDBC driver and/or database is ultimately responsible for the resulting query behavior.
(0003068)
ferg   
05-14-08 15:11   
php/1f0a

There is an issue with the JDBC driver and the value "0000-00-00 00:00:00" (throws exception)