PDO hates punctuation in placeholder values
If when upgrading a drupal module from Drupal 6 to Drupal 7 one hits an error like the following:
PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter
One may have problems with the formatting of the placeholder values for PDO. For instance several drupal.org threads talk about when dynamically naming these values, make sure not to put a colon (:) ine them. In my own case, of upgrading the e_activist module to drupal 7, it was the dots in table aliases that made PDO stumble.
This is OK:
$result = db_query("SELECT * FROM {e_activist_page_map} WHERE nid = :nid AND page = :page AND submit = :submit", array(':nid' => $node->nid, ':page' => $page, ':submit' => 1));
This was not (Note the e.xxxx in placeholder names)
$result = db_query("SELECT * FROM {e_activist_page_map} WHERE nid = :e.nid AND page = :e.page AND submit = :e.submit", array(':e.nid' => $node->nid, ':e.page' => $page, ':e.submit' => 1));
So if you need to differentiate between tables in placeholders, think up your own difference... maybe "e_" instead of "e.". Only alphanumeric and underscore are valid. (http://stackoverflow.com/questions/5809951/pdo-valid-characters-for-placeholders)