Closed (fixed)
Project:
Date
Version:
4.7.x-1.5
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Mar 2007 at 16:53 UTC
Updated:
25 Oct 2007 at 00:01 UTC
Had a SQL error when using a filter on date GREATER THAN now
It looks like in line
function date_views_filter_handler($op, $filter, $filterinfo, &$query, $field_type = 'iso') {
include_once(drupal_get_path('module', 'date_api') .'/date.inc');
$value = $filter['value'];
$type = $filterinfo['type'];
// Do some validation of input values before creating any SQL.
switch ($type) {
case 'YEAR':
case 'MONTH':
case 'DAY':
if (empty($value) || !($value == 'now' || is_numeric($value))) {
return;
}
break;
default:
if ($field_type == 'int' && (empty($value) || !($value == 'now' || date_is_valid($value, DATE_UNIX)))) {
return;
}
elseif (empty($value) || !($value == 'now' || date_is_valid($value, DATE_ISO))) {
return;
}
break;
}
$field = $filterinfo['extra']['field'];
$column = $filterinfo['extra']['column'];
$formats = date_get_formats($field);
$db_info = $filterinfo['content_db_info'];
$table = 'node_data_'. $field['field_name'];
$table_field = $db_info['columns'][$column]['column'];
$db_info doesn't get any values from $filterinfo array. As a matter of fact, the key "content_db_info" is not present in the $filterinfo array.
Comments
Comment #1
karens commentedI'm unable to replicate this when using latest code for both CCK and the Date module. The $filterinfo value is properly filled out and everything works as it should. The only reason I can think of for this would possibly be a caching issue where an outdated value got stuck in the Views cache.
Try again with the latest code after clearing the cache and see if you still have a problem.
Comment #2
Stol commentedAlso had this problem. I followed the suggestions of KarenS and it worked. First I clean the cache. Then I uninstalled the date module (disable date and date API in admin/modules >> save configuration >> remove the date folder in the modules folder >> refresh admin/modules (the entries for date and date API must be removed) >> save configuration again. Finally I installed the latest date module.
Cheers
Comment #3
Stol commentedIt's also important to save the views again otherwise the wrong query will be kept in the database.
Comment #4
karens commentedThere are a variety of things that are caused from outdated data stuck in the cache. The first thing to try in most cases is to pull up the edit screen of the view, make sure it still looks OK, and save it again (even if you made no changes). That will let you see if there is a bad value in the view and force the caches to be cleared out.
Comment #5
(not verified) commented