After enabling the dlike Module, anyone who has not the standard DB table layout (i.ex. because of using table-prefixes) will get an error:
WD php: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydb.system' doesn't exist: SELECT weight FROM system WHERE name = :flag; Array [error]
(
[:flag] => flag
)
in dlike_enable() (line 15 of /srv/www/myhost/www/public_html/sites/all/modules/dlike/dlike.install).
/srv/www/myhost/www/public_html/includes/bootstrap.inc).
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydb.system' doesn't exist: SELECT weight FROM system WHERE name = :flag; Array
(
[:flag] => flag
)
in dlike_enable() (line 15 of /srv/www/myhost/www/public_html/sites/all/modules/dlike/dlike.install).
This is because dlike is using the table name "system" in dbquery, without putting in brackets ({}).
Putting the table name in brackets, like: {system} fixed this issue.
Patch-Code:
15c15
< $flag_weight = db_query('SELECT weight FROM system WHERE name = :flag', array(':flag' => 'flag'))->fetchField();
---
> $flag_weight = db_query('SELECT weight FROM {system} WHERE name = :flag', array(':flag' => 'flag'))->fetchField();
Comments
Comment #0.0
svarco commentedreplaced host name and db name with generic values
Comment #0.1
svarco commentedanother replacemanet
Comment #1
kenneth.venken commentedCan confirm this. Attached is the above patch-code in patch form.
Comment #2
fotuzlab commentedThanks svarco for pointing out. Some loose coding here :(
@kenneth. Thanks for the patch, but I think you have put the braces at the wrong place. :)
Would you like to resubmit it?
Comment #3
kevin.klika commentedConfirmed the problem and the solution, the patch is incorrect, however.
Comment #4
kenneth.venken commented@fotuzlab: One line, one mistake. Not my best patch ;)
Retry...
Comment #5
fotuzlab commentedCommitted to dev. Attributed to svarco.
Appreciate the contribution from kenneth.venken
Comment #6.0
(not verified) commentedtypos