Answers.Body: <p>This error does show up in Civi 4.7.8 on Drupal 7.x.  @PeteRoss Thanks.  Haven't had chance to upgrade to 4.7.9 yet.</p>
  
  <p>Had to send scheduled event SMS to members, so modified sql in if statement in CRM/Mailing/BAO/MailingJob.php</p>
  
  <p>525  if ($mailing->sms_provider_id) {
    ....
    ....
    546                         OR       contact_a.do_not_sms = 0 )
  - 547                         $aclWhere}";
  + 547                         $aclWhere";
    548     }</p>
  
  <p>The scheduled SMS job completed successfully after the modification.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-30T14:17:07.957Z
Answers.Text: Is there a JIRA ticket open for this over at issues.civicrm.org?
Answers.UserDisplayName: Dan O'Brien
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-08T14:50:57.003Z
Answers.Text: I created https://github.com/civicrm/civicrm-core/pull/9002
Answers.UserDisplayName: ginkgoMZD
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-14T18:22:17.053Z
Answers.LastActivityDate: 2016-07-14T18:22:17.053Z
Answers.UserDisplayName: Raj
Answers.Body: <p>It appears that Civi on WordPress was throwing an extra } into the query from the file Mailingjob.php line 547. I hope this helps someone else and is there some way we can check if this affects others?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-11T03:15:27.597Z
Answers.LastActivityDate: 2016-07-11T03:15:27.597Z
Answers.UserDisplayName: PeteRoss
Body: <p>I'm getting an error message on scheduled SMS.</p>
  
  <p>Finished execution of Send Scheduled SMS with result: Failure, Error message: DB Error: syntax error</p>
  
  <p>I'm running 4.7.8 and I think it was stable in 4.7.6. My WP install is 4.5.3</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-07-07T04:11:01.597Z
Comments.Text: Finally had a chance to get back to this one. End of financial year is a killer!
  
  db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="
Comments.UserDisplayName: PeteRoss
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-07-07T04:17:03.417Z
Comments.Text: @Chris Burgess How do I load the entire backtrace here? It's a bit long. Thanks!
Comments.UserDisplayName: PeteRoss
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-07-07T08:09:14.517Z
Comments.Text: @PeteRoss I'd use https://gist.github.com or a "pastebin" site (Google for this, you'll find plenty of options).
Comments.UserDisplayName: Chris Burgess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-09-08T19:02:27.160Z
Comments.Text: I had the same problem on Drupal 7 running Civi 4.7.10. Thanks for fix Raj
Comments.UserDisplayName: Rob Squires
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-06-28T05:27:20.347Z
Comments.Text: Are you able to send an individual SMS without error? What service provider are you using for your SMS?
Comments.UserDisplayName: Allen Hutchison
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-06-28T09:23:23.747Z
Comments.Text: More details about the DB error should be available in your CiviCRM debug log ([instructions to locate](https://wiki.civicrm.org/confluence/display/CRMDOC/Debugging+for+developers#Debuggingfordevelopers-Logfiles)). If you find the "DB Error" in that logfile and share the backtrace here, you'll be able to get a more informed answer. Make sure no sensitive data (eg SMS provider login) is included :)
Comments.UserDisplayName: Chris Burgess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-06-29T06:28:42.607Z
Comments.Text: Thanks guys, I will get onto that. The provider is Clickatell and the system works when I send on test SMS.
Comments.UserDisplayName: PeteRoss
Tags: <civisms><scheduled-job>
Title: What causes the SMS system to stop working and throw DB errors?
ThreadText: # What causes the SMS system to stop working and throw DB errors?
  
  (Asked by: username_0 on 2016-06-27)
  
  I'm getting an error message on scheduled SMS.
  
  Finished execution of Send Scheduled SMS with result: Failure, Error message: DB Error: syntax error
  
  I'm running 4.7.8 and I think it was stable in 4.7.6. My WP install is 4.5.3
  
  **Tags:** civisms, scheduled-job
  
  > **Comments:**
  > **username_3**: Are you able to send an individual SMS without error? What service provider are you using for your SMS?  
  > **username_1**: More details about the DB error should be available in your CiviCRM debug log ([instructions to locate](https://wiki.civicrm.org/confluence/display/CRMDOC/Debugging+for+developers#Debuggingfordevelopers-Logfiles)). If you find the "DB Error" in that logfile and share the backtrace here, you'll be able to get a more informed answer. Make sure no sensitive data (eg SMS provider login) is included :)  
  > **username_0**: Thanks guys, I will get onto that. The provider is Clickatell and the system works when I send on test SMS.  
  > **username_0**: Finally had a chance to get back to this one. End of financial year is a killer!  db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="  
  > **username_0**: @username_1 How do I load the entire backtrace here? It's a bit long. Thanks!  
  > **username_1**: @username_0 I'd use https://gist.github.com or a "pastebin" site (Google for this, you'll find plenty of options).  
  > **username_2**: I had the same problem on Drupal 7 running Civi 4.7.10. Thanks for fix username_4  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_4 on 2016-07-14. Score: 3
  
  This error does show up in Civi 4.7.8 on Drupal 7.x. @username_0 Thanks. Haven't had chance to upgrade to 4.7.9 yet.
  
  Had to send scheduled event SMS to members, so modified sql in if statement in CRM/Mailing/BAO/MailingJob.php
  
  525 if ($mailing->sms\_provider\_id) {
  ....
  ....
  546 OR contact\_a.do\_not\_sms = 0 )
  - 547 $aclWhere}";
  + 547 $aclWhere";
  548 }
  
  The scheduled SMS job completed successfully after the modification.
  
  > **Comments:**
  > **username_5**: Is there a JIRA ticket open for this over at issues.civicrm.org?  
  > **username_6**: I created https://github.com/civicrm/civicrm-core/pull/9002  
  
  ---
  
  ### Answer by username_0 on 2016-07-11. Score: 1
  
  It appears that Civi on WordPress was throwing an extra } into the query from the file Mailingjob.php line 547. I hope this helps someone else and is there some way we can check if this affects others?
  
  
  ---
  
  