Attempting to delete a node with no URL records will cause an error. This is because there is no check being done to verify that there are actually any URL records before trying to delete them.

PDOException: SQLSTATE[42000]: 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 1: DELETE FROM {simplenews_statistics_click} WHERE (urlid IN ()) ; Array ( ) in simplenews_statistics_delete_clicks() (line 495 of simplenews_statistics/simplenews_statistics.module).

CommentFileSizeAuthor
#10 simplenews_statistics.module.patch701 bytesilaz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

  • dieuwe committed a48f9eb on 7.x-1.x
    Issue #2351763 by dieuwe: PDOException on newsletter node delete.
    
dieuwe’s picture

Status: Active » Fixed

Fix committed to development branch.

Hooligan’s picture

I just applied the update and still get an error when deleting a node.
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'votejuli_db.simplenews_statistics' doesn't exist: DELETE FROM {simplenews_statistics} WHERE (nid = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 99 ) in simplenews_statistics_node_delete() (line 122 of /home/votejuli/public_html/sites/all/modules/simplenews_statistics/simplenews_statistics.module).

hmm, wonder why I'm missing a table.

Hooligan’s picture

I confirmed, the module install is not creating the table named simplenews_statistics

dieuwe’s picture

Are you doing an upgrade from an older dev version? Have you run update.php?

If so, simplenews_statistics_update_7001() should add the missing table.

Either way, your problem is not related to this issue, so please do open a new issue if the problem is not solved by my recommendations above.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

redhatusr’s picture

I get the same error when I try to delete a newsletter

PDOException: SQLSTATE[42000]: 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 1: DELETE FROM {simplenews_statistics_click} WHERE (urlid IN ()) ; Array ( ) in simplenews_statistics_delete_clicks() (line 495 of /var/www/html/sites/all/modules/simplenews_statistics/simplenews_statistics.module).

I upgrade from alpha1 to dev version with this way:
1. drush dis simplenews_statistics
2. rm simplenews_statistics -rf
3. drush dl simplenews_statistics --dev
4. drush en simplenews_statistics
5. drush updb

the upgrade from alpha1 to dev version give me WSOD with i just view the newsletter and apache error log says:

[Thu Apr 23 05:41:25 2015] [error] [client 192.168.1.44] PHP Fatal error: Call to undefined function simplenews_issue_newsletter_id() in /var/www/html/sites/all/modules/simplenews_statistics/simplenews_statistics.module on line 70

any ideas?

zanscath’s picture

I got the same error when trying to delete a newsletter that hasn't been sent yet, not even to a test address. I think they didn't provide conditions for when no statistics are available for that node so perhaps you have to send it first or just click on the statistics tab for that newsletter at least once - I don't really know, but aster I did this, I could delete the newsletter.

rcodina’s picture

7.x-1.0-alpha1 has this bug but it's fixed on dev branch. Please, create a new release with this!

ilaz’s picture

I've just created a patch to be used in a continuos integration workflow with the 7.x-1.0-alpha1 version. It may be useful for you.

yemoko’s picture

Hi,
The patch worked for me .
Thank you!