SQL query error if database installed with prefix
O_o - April 27, 2007 - 11:36
| Project: | Taxonomy Query Language |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
If the Drupal database was installed with a prefix, as in my case where I added "intranet", the query below will break because there is no table called "term_node". It is, in my case, called "intranetterm_node".
* user warning: Table 'intranet.term_node' doesn't exist query: SELECT COUNT(*) FROM intranetnode WHERE status = 1 AND nid in (SELECT * FROM (SELECT DISTINCT nid FROM `term_node` WHERE tid in (4)) AS finalTable) in /var/www/html/intranet/includes/database.mysqli.inc on line 151.
* user warning: Table 'intranet.term_node' doesn't exist query: SELECT nid FROM intranetnode WHERE status = 1 AND nid in (SELECT * FROM (SELECT DISTINCT nid FROM `term_node` WHERE tid in (4)) AS finalTable) LIMIT 0, 10 in /var/www/html/intranet/includes/database.mysqli.inc on line 151.The actual SQL query is this one:
SELECT COUNT(*)
FROM intranetnode
WHERE status = 1
AND nid in (SELECT * FROM (SELECT DISTINCT nid FROM `term_node` WHERE tid in (4))
AS finalTable);
#1
I could fix that by changing line 252 to this:
$sql = $sqlGenerator->generate($parser->ast, $tagTank->terms, db_prefix_tables('{term_node}'));But the autocomplete still does not work for me, don't know if this is related.
#2
Hi,
I could solve this by just changing:
$sql = $sqlGenerator->generate($parser->ast, $tagTank->terms, 'term_node');to
$sql = $sqlGenerator->generate($parser->ast, $tagTank->terms, '{term_node}');So only adding {} was enough.
greetings,
Martijn
#3
I've committed the changes to the D5 branch and HEAD.
Thank you.
#4
Automatically closed -- issue fixed for 2 weeks with no activity.