Problem/Motivation

When attempting to view the message on a site that uses table prefixes, an exception gets thrown that the table does not exist. The exception message that was thrown for one of my sites was:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'tdrupaltutor.contact_save' doesn't exist: SELECT `read` FROM contact_save WHERE id = :id; Array ( [:id] => 1 ) in [file path]/contact_save.module on line 144.

Proposed resolution

Line 144 in contact_save.module has

$query = "SELECT `read` FROM contact_save WHERE id = :id";

when it should be

$query = "SELECT `read` FROM {contact_save} WHERE id = :id";

so that the table prefixes are added to the query when db_query is ran.

Remaining tasks

Module needs to be updated with the stated recommendation. Testing should be done on a Drupal site that uses table prefixes.

User interface changes

None.

API changes

None.

Data model changes

There should be no impact on existing sites as this is a change to a select statement.

Comments

Anonymous’s picture

bitsecond created an issue. See original summary.

ytsurk’s picture

Status: Active » Fixed

same issue here.

this is already fixed in the -dev branch using the Database abstraction layer more sophisticated.

Status: Fixed » Closed (fixed)

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