Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-7189

Problems with logging feature in multilingual install / database name containing special characters

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.3.0
    • Fix Version/s: 3.3.2
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      I am running a multilingual CiviCRM installation (3.3.0) on Drupal 6.19
      The new logging feature was never switched on and is deactivated due to the multilingual installation.
      When saving new Custom Data I get the following error:
      -----------------------------------8<-----------------------------------------
      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 '-civicrm LIKE 'log_civicrm_%'' at line 1, 1064
      Additional Details:
      Array
      (
      [callback] => Array
      (
      [0] => CRM_Core_Error
      [1] => handle
      )

      [code] => -2
      [message] => DB Error: syntax error
      [mode] => 16
      [debug_info] => SHOW TABLES FROM test-civicrm LIKE 'log_civicrm_%' [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 '-civicrm LIKE 'log_civicrm_%'' at line 1]
      [type] => DB_Error
      [user_info] => SHOW TABLES FROM test-civicrm LIKE 'log_civicrm_%' [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 '-civicrm LIKE 'log_civicrm_%'' at line 1]
      [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SHOW TABLES FROM test-civicrm LIKE 'log_civicrm_%' [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 '-civicrm LIKE 'log_civicrm_%'' at line 1]"]
      )
      ----------------------------------->8-----------------------------------------

      Replacing line 62 of civicrm/CRM/Logging/Schema.php:

      $dao = CRM_Core_DAO::executeQuery("SHOW TABLES FROM {$this->loggingDB} LIKE 'log_civicrm_%'");
      with
      $dao = CRM_Core_DAO::executeQuery("SHOW TABLES FROM `{$this->loggingDB}` LIKE 'log_civicrm_%'");

      fixes the error message, which would most probably also appear if logging ist turned on with a database name containing special characters.

      I didn't look in detail, but I'm not sure if this code is supposed to be executed at all if logging feature is disabled.

        Attachments

          Activity

            People

            • Assignee:
              shot Piotr Szotkowski
              Reporter:
              thomas.feichter Thomas Feichter
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: