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

cron job returns db "error: syntax error"

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.4.5
    • Fix Version/s: None
    • Component/s: CiviMail

      Description

      Original thread first reported on the forum: http://forum.civicrm.org/index.php?topic=32909

      *****************
      I am running Wordpress 3.9.1 and CiviCRM 4.4.5.
      Trying to set up my first automated report via cron to mail myself a contribution report every month.
      Initially, I received a permissions error in the job log under Scheduled Jobs and after referring to this thread, I gave the Wordpress anonymous user access to CiviReport. This fixed the permissions problem but now I receive a db error. The "Mail reports" Scheduled Job uses api.job.mailReport. Any help is appreciated. Thank you.

      Below is an extract from the "Scheduled Jobs Log" under Administer – System Settings – Scheduled Jobs – View Job Log.

      Summary
      Finished execution of Mail Reports with result: Failure, Error message: DB Error: syntax error
      Details

      Parameters raw (from db settings):
      instanceId=38
      format=print

      Parameters parsed (and passed to API method):
      a:3:

      {s:7:"version";i:3;s:10:"instanceId";s:2:"38";s:6:"format";s:5:"print";}

      Full message:
      Finished execution of Mail Reports with result: Failure, Error message: DB Error: syntax error

      Below is an extract from the CiviCRM log file under wp-content/plugins/files/civicrm/ConfigAndLog that provides more detail on the error:

      May 29 13:45:02 [info] $backTrace = #0 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(770): CRM_Core_Error::backtrace("backTrace", TRUE)
      #1 [internal function](): CRM_Core_Error::exceptionHandler(Object(DB_Error))
      #2 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
      #3 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/packages/DB.php(969): PEAR_Error->PEAR_Error("DB Error: syntax error", -2, 16, (Array:2), "CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS SELECT contact...")
      #4 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-2, 16, (Array:2), "CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS SELECT contact...")
      #5 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -2, NULL, NULL, "CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS SELECT contact...", "DB_Error", TRUE)
      #6 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/packages/DB/mysql.php(898): DB_common->raiseError(-2, NULL, NULL, NULL, "1064 ** You have an error in your SQL syntax; check the manual that correspon...")
      #7 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/packages/DB/mysql.php(327): DB_mysql->mysqlRaiseError()
      #8 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS SELECT contact...")
      #9 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2421): DB_common->query("CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS SELECT contact...")
      #10 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1613): DB_DataObject->_query("CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS SELECT contact...")
      #11 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(160): DB_DataObject->query("CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS SELECT contact...")
      #12 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(908): CRM_Core_DAO->query("CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS SELECT contact...", TRUE)
      #13 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Report/Form/Contribute/Detail.php(605): CRM_Core_DAO::executeQuery("CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS SELECT contact...")
      #14 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Report/Form.php(620): CRM_Report_Form_Contribute_Detail->postProcess()
      #15 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Report/Form/Contribute/Detail.php(386): CRM_Report_Form->preProcess()
      #16 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(351): CRM_Report_Form_Contribute_Detail->preProcess()
      #17 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Display.php(93): CRM_Core_Form->buildForm()
      #18 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Report_Form_Contribute_Detail), "display")
      #19 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Report_Form_Contribute_Detail), "display")
      #20 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(339): HTML_QuickForm_Page->handle("display")
      #21 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php(117): CRM_Core_Controller->run()
      #22 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Report/Utils/Report.php(373): CRM_Utils_Wrapper->run("CRM_Report_Form_Contribute_Detail", NULL, (Array:2))
      #23 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/api/v3/Job.php(236): CRM_Report_Utils_Report::processReport((Array:3))
      #24 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/api/api.php(87): civicrm_api3_job_mail_report((Array:3))
      #25 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/JobManager.php(132): civicrm_api("Job", "mail_report", (Array:3))
      #26 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/JobManager.php(88): CRM_Core_JobManager->executeJob(Object(CRM_Core_ScheduledJob))
      #27 /home/ashraya/www/www/wp-content/plugins/civicrm/civicrm/bin/cron.php(42): CRM_Core_JobManager->execute()
      #28

      {main}

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mithunmukherjee Mithun Mukherjee
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: