Table prefix error
modul - January 27, 2008 - 20:18
| Project: | RelatedContent |
| Version: | 5.x-1.6-beta2 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | TBarregren |
| Status: | closed |
Jump to:
Description
Installation of RelatedContent 1.6beta2 in Drupal 5.6 went smoothly, but when I opened a content type in my admin section, I got this error:
user warning: Table 'xxxx.druXX_druXX_relatedcontent_view' doesn't exist query: _relatedcontent_db_sanitize_relatedcontent_view_table DELETE druXX_druXX_relatedcontent_view FROM (druXX_druXX_relatedcontent_view LEFT OUTER JOIN druXX_view_view ON druXX_druXX_relatedcontent_view.vid = druXX_view_view.vid LEFT OUTER JOIN druXX_relatedcontent ON druXX_druXX_relatedcontent_view.vid = druXX_relatedcontent.vid) WHERE druXX_view_view.vid IS null AND druXX_relatedcontent.vid IS null in /www/virtualhosts/www.mysite.com/includes/database.mysql.inc on line 172."druXX_" is my table prefix. Notice that sometimes, not always, it occurs twice in adressing the tables in the query, which obviously leads to errors, making the module unusable. Hopefully, this can be corrected? I think the concept looks promising.

#1
Oops! A typo is the cause of your problems.
Replace the
relatedcontent.mysql.incwith the corrected version to fix the problem.EDIT: I have updated the link above to the same file as in #6 below.
#2
Thanks for the swift reply, TBarregren!
But I think something is still wrong.
- I do get RelatedContent in my list of modules, and I marked it to "on".
- Then I wanted to go to "Administration by module" (don't know the correct English term, but you know what I mean, the link on top of the Module list). To my surprise, there was no mention of RelatedContent there. I expected access control to be reached from there, but that was not the case.
- I went to Views, to see if something would be there, but again, no RelatedContent connection whatsoever.
- I also went to a couple of content types, but again, nothing.
There were no error messages, but (apart from the module list) RelatedContent was simply not there.
Did I still do something wrong?
#3
The module only uses built in permissions, so there are no RelatedContent specific permissions.
Morever, since the module settings are individually for each content type, you find them by going to Administer » Content management » Content types, and click on the content type for which you want to enable RelatedContent.
Click on the RelatedContent configuration link to expand the settings. Tick the checkbox named Enable to allow related content of nodes for this particular content type. Review the settings, and choose one or more views. Clink on the Save content type button.
This is described in the quick start guide on the module's page as well in the module's handbook page.
(The handbook page is for version 1-5 of the module.)
#4
And thanks again, TBarregren, for your clear and speedy reply! I have made progress, I have found the settings of RelatedContent. And yes, I should have read your instruction pages more thoroughly. Sorry for that.
There is still a problem, however.
I took ContentTypeA, and 'connected' it to a view listing some results, doesn't matter what. When I went to the full view of a node belonging to ContentTypeA, expecting it to be followed by the result of RelatedContent, i.e. the view, I got this MySQL error (and once again it has to do with the prefix, but in a different way) :
* user warning: Table 'XXXXX.relatedcontent' doesn't exist query: _relatedcontent_db_load SELECT r.nid, r.vid, r.include_nid FROM relatedcontent r INNER JOIN relatedcontent_view v ON r.vid = v.vid AND r.nid = 2756 ORDER BY v.weight, r.ordinal_number in /www/virtualhosts/www.mysite.com/includes/database.mysql.inc on line 172.* user warning: Table 'XXXXXX.relatedcontent' doesn't exist query: _relatedcontent_db_load SELECT r.nid, r.vid, r.include_nid FROM relatedcontent r INNER JOIN relatedcontent_view v ON r.vid = v.vid AND r.nid = 2755 ORDER BY v.weight, r.ordinal_number in /www/virtualhosts/www.mysite.com/includes/database.mysql.inc on line 172.
* user warning: Table 'XXXXXX.relatedcontent' doesn't exist query: _relatedcontent_db_load SELECT r.nid, r.vid, r.include_nid FROM relatedcontent r INNER JOIN relatedcontent_view v ON r.vid = v.vid AND r.nid = 1483 ORDER BY v.weight, r.ordinal_number in /www/virtualhosts/www.mysite.com/includes/database.mysql.inc on line 172.
As you can see, there is no prefix (the XXXXX stands for the name of my database. My tables all start with druXX_ as prefix. I suppose this requires just the correction of another typo, but your code is bit too daunting for me to just jump into :-)
Could you have a look at this? I am getting the feeling that RelatedContent is a Very strong module, and I'm very eager to get it working...
#5
Oops again! :-)
Yes, it is another typo in the SQL-statements in the
relatedcontent.mysql.incfile. The table name's should be surrounded by braces, e.g.{relatedcontent}and{relatedcontent_view], but I have missed that in both_relatedcontent_db_sanitize_relatedcontent_view_table_query()and_relatedcontent_db_load_query(). That explains both your reported errors.I am embarrassed that I didn't check for that typo in the other functions on your first report. But I have done that now, and I believe there should be no more problems.
Thank you for spotting these bugs.
Replace the
relatedcontent.mysql.incfile with the corrected version.#6
And hi again, TBarregren. Thank you so much for fixing these bugs instantaneously!! And yes, now it works. I tried with a few content types and a few queries, and I think it is working smoothly. Pretty impressive stuff! I'm sure I and many others will include this module in their sites, with splendid results. Thanks for the quick interventions, and much more even for the good job you did by creating this module.
#7
The corrected file is included in the beta 3.
#8
Automatically closed -- issue fixed for two weeks with no activity.