Posted by regli on May 8, 2007 at 5:57am
Jump to:
| Project: | Content Recommendation Engine |
| Version: | master |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
The votingapi module doesn't seem to handle the Drupal database prefix. I got the following message while trying to administer "Node Recommendation":
user warning: Table 'd60369957.votingapi_vote' doesn't exist query: SELECT DISTINCT tag from votingapi_vote in /mnt/w0201/d36/s35/b02ae1cf/www/bullbearbuzz.com/cms/includes/database.mysql.inc on line 172.
Comments
#1
The problem is actually in voting_actions (voting_actions.inc). A temporary fix can be applied by changing the distinct query to as follows where drup_ is the Drupal DB prefix.
$results = db_query("SELECT DISTINCT %s FROM {drup_votingapi_vote} WHERE content_type = 'node'", $field,
#2
this is the same bug as it was reported to cache.module (http://drupal.org/node/126867). Also votingapi.module (_votingapi_distinct_value()) is involved. The solution seems to be replacing the {%s} parts by ".{$table}." (where applicable). I will try to roll a patch later today if i have some time.
#3
I have the same problem with db prefix missing on this sql query,
SELECT vote_id, uid, content_id, content_type FROM votingapi_vote WHERE vote_id < -1 ORDER BY vote_id DESC LIMIT 5 in mysql.inc on line 172.
Unfortunately, I don't know how to figure out which module is causing this. I've gone through each module i have installed, i.e. extra voting forms, votingapi, voting_actions, and aggregation, but I can not find where this query is located. I know I just need to ensure the db prefix is on there to make it work, but I can't find the query in any code.
Is there anything you can think of that helps? Also, i only receive the error through cron running.
I did make the other changes mentioned above to resolve those specific error messages involved in two instances. But, i can't find the query above anywhere.
#4
Snapple! spoke too soon. Found the problem in the cre.module file. around line 387
$db_result = db_query("SELECT vote_id, uid, content_id, content_type FROM votingapi_vote
WHERE vote_id < %d
ORDER BY vote_id DESC LIMIT %d", $starting_pos, $vote_limit);
changed to
$db_result = db_query("SELECT vote_id, uid, content_id, content_type FROM {votingapi_vote}
WHERE vote_id < %d
ORDER BY vote_id DESC LIMIT %d", $starting_pos, $vote_limit);
Not exactly the %s issue, but resolved anyways.
Funny that i was finally able to find the code with a google search for "votingapi_vote WHERE vote_id" and seeing the code here,
http://drupal.org/files/issues/patch_143.txt
My CRE appears to be the latest stable version: 5.x-1.0 on 2007-Jan-21.
#5
If this is, indeed, a CRE problem it shouldn't be logged here. Thanks!
Regarding the earlier report, Voting Actions is no longer part of the VotingAPI module; at some point I may be able to pick it back up, but at present I don't have the bandwidth to upgrade it to D5/D6 properly.