Details
-
Type:
Bug
-
Status: Done/Fixed
-
Priority:
Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.5.4, 4.6.10
-
Component/s: Core CiviCRM
-
Labels:
-
Documentation Required?:None
-
Funding Source:Contributed Code
Description
I was writing a custom CiviCRM extension and a couple of the tables have only a single column. When I enabled logging, I received the following:
Dec 08 12:37:18 [info] $Fatal Error Details = Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)
[code] => -2
[message] => DB Error: syntax error
[mode] => 16
[debug_info] => CREATE TABLE `aobalive_J34Civ46`.log_civicrm_aoba_contact_seq (
`id` int(11) DEFAULT NULL
log_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
log_conn_id INTEGER,
log_user_id INTEGER,
log_action ENUM('Initialization', 'Insert', 'Update', 'Delete')
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 [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 'log_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
log_conn_id INTEGER' at line 3]
[type] => DB_Error
[user_info] => CREATE TABLE `aobalive_J34Civ46`.log_civicrm_aoba_contact_seq (
`id` int(11) DEFAULT NULL
log_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
log_conn_id INTEGER,
log_user_id INTEGER,
log_action ENUM('Initialization', 'Insert', 'Update', 'Delete')
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 [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 'log_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
log_conn_id INTEGER' at line 3]
[to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="CREATE TABLE `aobalive_J34Civ46`.log_civicrm_aoba_contact_seq (
`id` int(11) DEFAULT NULL
log_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
log_conn_id INTEGER,
log_user_id INTEGER,
log_action ENUM('Initialization', 'Insert', 'Update', 'Delete')
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 [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 'log_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
log_conn_id INTEGER' at line 3]"]
)
Looking through the trace, I was able to find and implement a quick hack to fix it. In CiviCRM 4.6.10, CRM/Logging/Schema.php Line 520.
I attached a diff of the file change I made.