I am using a feeds hook to email some information to workbench section users. I've been changing some of my code and suddently I'm getting a database error:
SQLSTATE: Syntax error or access violation: 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 '))' at line 2
This error doesn't show enough of the query to let me know which one it is, what line number or function it originates in, etc. I've tried putting a debug_backtrace() in the core definition of the drupal_set_message() function but I did not find my functions in it, just batch functions. I also tried putting backtraces in the DatabaseStatementBase classes' execute() method, but that caused the site to output a bunch of junk information on the screen.
How can I backtrace this error or otherwise track it down? The only thing that occurs to me put error messages around each query I'm running to see where the actual error falls. Is this the best way?