In 4.7 RC2 and RC3, I created a vocabulary to support free tagging.
I created a node and typed in my new tag and received an error. In the error code provided, I used a non-free tagging term and the new one "Common Japanese Difficulties" which, as you can see, is not working.
I guess the text:
AND td.tid IN (45,Common Japanese Difficulties)
should either be a number or in quotes.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Japanese Difficulties) AND th.tid IS NULL' at line 1 query: SELECT DISTINCT td.tid FROM term_data td LEFT JOIN term_hierarchy th on td.tid = th.parent WHERE td.vid IN (1) AND td.tid IN (45,Common Japanese Difficulties) AND th.tid IS NULL in C:\server\drupal\www\includes\database.mysql.inc on line 120.
Here is the referenced code plus some line numbers on the left...
/**
* Helper function for db_query().
*/
93: function _db_query($query, $debug = 0) {
global $active_db, $queries;
if (variable_get('dev_query', 0)) {
list($usec, $sec) = explode(' ', microtime());
$timer = (float)$usec + (float)$sec;
}
101: $result = mysql_query($query, $active_db);
if (variable_get('dev_query', 0)) {
$bt = debug_backtrace();
$query = $bt[2]['function'] . "\n" . $query;
list($usec, $sec) = explode(' ', microtime());
$stop = (float)$usec + (float)$sec;
$diff = $stop - $timer;
$queries[] = array($query, $diff);
}
if ($debug) {
print '<p>query: '. $query .'<br />error:'. mysql_error($active_db) .'</p>';
}
if (!mysql_errno($active_db)) {
return $result;
}
else {
120: trigger_error(check_plain(mysql_error($active_db) ."\nquery: ". $query), E_USER_WARNING);
return FALSE;
}
}
any advice?
Comment | File | Size | Author |
---|---|---|---|
#4 | tac_free_tag_support.patch | 2.88 KB | myriad |
Comments
Comment #1
myriad CreditAttribution: myriad commentedyup, if I disable Free Tagging than there is no error when updating a node. However, once Free Tagging is enabled, I get the error after updating a node.
I haven't noticed anything not working.
Comment #2
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedThe query you encounter errors with does not seem to be defined in Drupal core. Do you use any contrib modules? Please move this issue to them.
Comment #3
myriad CreditAttribution: myriad commentedThat's right, it is the result of a contrib. After disabling TAC_LITE the problem disappeared. I'll submit a request there, thank you!
Comment #4
myriad CreditAttribution: myriad commentedAfter looking through the source I found the function that needs to be updated, _tac_lite_get_terms(&$node). The author was already aware that free tagging wasn't supported. The comments said the code was borrowed from taxonomy.module, and so I did the same. I added free tagging support and now I don't see any errors with my changes.
Comment #5
Dave Cohen CreditAttribution: Dave Cohen commentedI do not like the patch provided because it contains code that belongs in taxonomy.module, not tac_lite. (In fact the code is in taxonomy.module). Instead, I checked in this.
This avoids the error when saving a node with free-tagging. However, we still do not use the free tagging terms for access control. We could, if taxonomy stored the tids that it created for us to see, but it does not. However, this is no big deal, as noone in their right mind will use a free-tagging vocabulary for access control. The reason being that every new tag they type will not have any access control privileges configured, and would therefor be hidden from all users. Who would want that?
Thanks for submitting bug and patch.
Comment #6
(not verified) CreditAttribution: commentedComment #7
bablakely CreditAttribution: bablakely commentedDave, I disagree with #5. I have a site where I have a free tagging environment, but where I have pre-entered a tag of "Public", which I want to use to make nodes viewable by anonymous users. I currently cannot do this, and this is a deal-breaker for me.
Comment #8
bablakely CreditAttribution: bablakely commentedReopening pending further discussion.
Comment #9
Dave Cohen CreditAttribution: Dave Cohen commentedWhy not put the "Public" term in another, non-free tagging vocabulary?