Disclaimer: this is needed for an old and ugly codebase that I'd much rather not touch.
- There is a table in the database that has a column (among many others) of
DATE
type. - There is a query (auto generated by Torque criteria - don't ask) with
java.util.Date
parameter; Torque formats it as full datetime.
So, the query MySQL is getting is something like:
SELECT * FROM my_table
WHERE my_date = '20091201105320'; // 2009-12-01 10:53:20
The problem is that on one server which has MySQL 5.0.27-standard it works just fine - as in returns all the records from my_table
that have my_date
set to '2009-12-01'. On another server which has MySQL 5.0.45 it does not work. The data is there - if I manually run the query after trimming the time portion out I get correct results back.
The question is:
Is there a setting somewhere, either in MySQL configuration file or in per-session variables (connection string) or somewhere else to force MySQL to ignore the time portion during string constant to date conversion?
I obviously can't use DATE()
function without changing the codebase which I'd much rather not.