When I try to delete a node I get a PDOException and it only happens if the module Redirect is activated.

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 ':db_condition_placeholder_1 ESCAPE '\\') OR (redirect LIKE :db_condition_placeho' at line 1: SELECT redirect.rid AS rid FROM {redirect} redirect WHERE ( (source LIKE :db_condition_placeholder_0 ESCAPE '\\') OR (source LIKE :db_condition_placeholder_1 ESCAPE '\\') OR (redirect LIKE :db_condition_placeholder_2 ESCAPE '\\') OR (redirect LIKE :db_condition_placeholder_3 ESCAPE '\\') ); Array ( [:db_condition_placeholder_0] => node/1671 [:db_condition_placeholder_1] => node/1671/% [:db_condition_placeholder_2] => node/1671 [:db_condition_placeholder_3] => node/1671/% ) i redirect_delete_by_path() (rad 780 av /home/l/licab/www/tekinfo/tekinfo/sites/all/modules/redirect/redirect.module).

However I am still not sure this is related to the redirect module as it works on my staging server, but not on my web hotel (FS Data), where I am using PHP 5.2.14 and MySQL 5.0.67.

I have done some trial and error and found that the error message disappears if I remove the or condition in redirect_delete_by_path.

function redirect_delete_by_path($path) {
  $query = db_select('redirect');
  $query->addField('redirect', 'rid');
  //$query_or = db_or();
  //$query_or->condition('source', db_like($path), 'LIKE');
  //$query_or->condition('source', db_like($path . '/') . '%', 'LIKE');
  //$query_or->condition('redirect', db_like($path), 'LIKE');
  //$query_or->condition('redirect', db_like($path . '/') . '%', 'LIKE');
  //$query->condition($query_or);
  
  $rids = $query->execute()->fetchCol();

  if ($rids) {
    return redirect_delete_multiple($rids);
  }
}

Right now I'm stuck. Anybody who can give me any pointers on how to go on?

Comments

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

What database engine are you using? I have not been able to duplicate this.

ropaolle’s picture

Thanks for your quick replay. I am using MyISMA version 10 (both on my local installation and on the web hotel). But the exception only happens on the web hotel.

ropaolle’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

I did not solve this issue but have moved the site from a shared host to vps and then it works.