Closed (fixed)
Project:
Queryable Variables
Version:
6.x-3.9
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Apr 2010 at 00:51 UTC
Updated:
11 May 2010 at 16:20 UTC
Trying to track this one down but date field is always 0000-00-00 00:00:00. Therefore, queryable_variables_get_date() returns 0000-00-00 00:00:00 all of the time.
Comments
Comment #1
tpainton commentedWell, the query is being created correctly. It is being passed to drupal_write_record in the correct format, for some reason, the string NOW() just isn't being converted to the right date. I am using MySQL version 5.1. Not sure what the problem is, but I created a fix that appears to work.
Line 297 is changed from
$var->date = 'NOW()';
to
$var->date = date('Y-m-d H:i:s', strtotime('now'));;
This places the correct date into the date field in the expected format.
I am wondering if this is a bug in drupal_write_record? As I said before, dumping the vars in drupal_write_record creates an appropriate query, it's just not applying the correct date. A raw "SELECT NOW()" from my MySQL console DOES give me the correct date so it doesn't appear to be my SQL server.
Comment #2
crystaldawn commentedHmmm, I'll check it and see if I get the same result on my server here. I dont use it myself, but I figured others would so I tossed it in.
Comment #3
crystaldawn commentedThis is indeed a bug in the drupal_write_record(). But I'm thinking it's more of a feature rather than a bug. It's possible that other databases do not have a NOW() function and thus it's stripped out? I dunno. Either way this does indeed fix it so I've added it as a fix along with some of the other minor fixes that I had as issues and put it in a new release.
Comment #4
tpainton commentedHmm. I guess it might be worth posting to the drupal issue que and see what the response is. I will try to do that.
Comment #5
tpainton commentedsetting to needs review. It works for me. I assume once this is released we can mark as fixed.
Comment #6
crystaldawn commentedI already added this to a release last week :)
Comment #7
tpainton commentedOh! :)