"user warning Table doesn't exist query" after viewing for the 1st time a cached image using a custom action - (database prefix)
anrikun - September 15, 2009 - 12:47
| Project: | Imagecache Actions |
| Version: | 6.x-1.6 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
The error is repeated for each content type and each imagefield:
user warning: Table 'dbname.content_type_xxx' doesn't exist query: SELECT nid FROM content_type_xxx WHERE field_xxx_fid = 1422 in xxx/sites/all/modules/imagecache_actions/utility.inc on line 346.
user warning: Table 'dbname.content_field_xxx' doesn't exist query: SELECT nid FROM content_field_xxx WHERE field_xxx_fid = 1422 in xxx/sites/all/modules/imagecache_actions/utility.inc on line 346.
#1
Custom action is attempting to help you out and provide context data about the image it's working on.
It does so by trying to see which filefield entry, and which corresponding node is matched up with that filepath.
To do so, it unfortunately has to look deeper into the database than I'd like it to - it needs to reverse-lookup the schema to guess what the tables are called - as CCK doesn't normally look backwards like that.
Looks like the rule for that is not working for you.
Do you really not have a content type named like that? Or is the content type we are expecting to see provided by another module - not CCK? What version of CCK?
That SQL implies you are using CCK 1003+
Although I'm tring to use the API to deduce the table names, it could be out of sync.
Any chance you can see a table of that name or something very like it in your database?
#2
I think I got it:
The tablenames you use don't include the prefix: my tablenames are all prefixed by 'drupal_'.
#3
OK, that's understandable - sorta.
I THOUGHT I was handling prefixes though!
Maybe PHP is collapsing my {} because it sees a variable inside it ...
<?php$result = db_query("SELECT nid FROM {$tablename} WHERE ". join(' OR ', $wheres), $query_args);
?>
#4
Replace it by:
<?php$result = db_query('SELECT nid FROM {'.$tablename.'} WHERE '. join(' OR ', $wheres), $query_args);
?>
and the error is gone :-)
See http://www.php.net/manual/en/language.types.string.php#language.types.st...
#5
OMFG.
Yep, that's what it is alright! That's a good fix, thanks, I'll put it into -dev now!
:-)
I was a bit nervous about the internal SQL I have to do here, but at least this issue has a clear answer.
Could be I didn't see the error because I was testing on a DB that had both prefixed and unprefixed tables in from different but similar multisites - the table existed for me ... but was from the wrong site!
Thanks heaps.
.dan.
#6
fixed in -dev.
About time I rolled a new release I think, lots of features happend.
#7
I'm looking forward to see them!
Thank you for your great module.
By the way a feature request (don't know if it's possible though...):
http://drupal.org/node/578804
#8
Automatically closed -- issue fixed for 2 weeks with no activity.