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

tpainton’s picture

Well, 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.

crystaldawn’s picture

Hmmm, 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.

crystaldawn’s picture

This 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.

tpainton’s picture

Hmm. I guess it might be worth posting to the drupal issue que and see what the response is. I will try to do that.

tpainton’s picture

Status: Active » Needs review

setting to needs review. It works for me. I assume once this is released we can mark as fixed.

crystaldawn’s picture

Status: Needs review » Fixed

I already added this to a release last week :)

tpainton’s picture

Oh! :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.