Fix for ticket #3020: set MySQL session time_zone variable to UTC ('+0:00') so TIMESTAMP column values are comparable against our other UTC timestamp values.

MySQL stores TIMESTAMP columns as UTC, but with a local time interface. (SRSLY?!) DATETIME columns are always bare and assumed to be local time, but we keep only UTC in them.
Forcing the session time_zone to UTC means we won't have to worry as much about what we're sending/receiving in there.

Also will let us remove the hack in master commit a7abb2323e for session tweaks
This commit is contained in:
Brion Vibber 2011-01-31 11:45:19 -08:00
parent 5b8e74f8d4
commit 54f7154db8

View File

@ -480,6 +480,10 @@ class Memcached_DataObject extends Safe_DataObject
}
}
}
// Needed to make timestamp values usefully comparable.
if (common_config('db', 'type') == 'mysql') {
parent::_query("set time_zone='+0:00'");
}
}
return $result;