Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Critical
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.3.2
-
Fix Version/s: 3.3.3
-
Component/s: CiviReport
-
Labels:None
Description
When CiviReport includes a smart group in the criteria, a DB Error: syntax error is thrown. It was introduced while attempting to fix CRM-7207.
Attached is the patch that corrects the syntax error (removes extra right hand parenthesis and single quotes the date). Below is the full error details dump. This happens on a clean 3.3.2 install and on demo. To reproduce, simply include a smart group in your criteria for a CiviReport.
Database Error Code: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '17:07:11)) >= 0))' at line 4, 1064
Additional Details:
Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)
[code] => -2
[message] => DB Error: syntax error
[mode] => 16
[debug_info] =>
SELECT g.id
FROM civicrm_group g
WHERE g.id IN ( 2 ) AND ( g.saved_search_id IS NOT NULL OR g.children IS NOT NULL ) AND
(g.cache_date IS NULL OR (TIMESTAMPDIFF(MINUTE, g.cache_date, 2011-01-08 17:07:11)) >= 0))
[nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '17:07:11)) >= 0))' at line 4]
[type] => DB_Error
[user_info] =>
SELECT g.id
FROM civicrm_group g
WHERE g.id IN ( 2 ) AND ( g.saved_search_id IS NOT NULL OR g.children IS NOT NULL ) AND
(g.cache_date IS NULL OR (TIMESTAMPDIFF(MINUTE, g.cache_date, 2011-01-08 17:07:11)) >= 0))
[nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '17:07:11)) >= 0))' at line 4]
[to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="
SELECT g.id
FROM civicrm_group g
WHERE g.id IN ( 2 ) AND ( g.saved_search_id IS NOT NULL OR g.children IS NOT NULL ) AND
(g.cache_date IS NULL OR (TIMESTAMPDIFF(MINUTE, g.cache_date, 2011-01-08 17:07:11)) >= 0))
[nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '17:07:11)) >= 0))' at line 4]"]
)