From 930f8ca445b3029532cea4bd75b0b63e452b5e88 Mon Sep 17 00:00:00 2001
From: Neil Drumm <drumm@3064.no-reply.drupal.org>
Date: Sun, 11 Jun 2006 22:46:20 +0000
Subject: [PATCH] #61912 by doq and killes, add db_rewrite_sql() to
 taxonomy/autocomplete.

---
 modules/taxonomy.module          | 2 +-
 modules/taxonomy/taxonomy.module | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/taxonomy.module b/modules/taxonomy.module
index 24df32228460..c2920a7c03a9 100644
--- a/modules/taxonomy.module
+++ b/modules/taxonomy.module
@@ -1369,7 +1369,7 @@ function taxonomy_autocomplete($vid, $string = '') {
   // Fetch last tag
   $last_string = trim(array_pop($array));
   if ($last_string != '') {
-    $result = db_query_range("SELECT name FROM {term_data} WHERE vid = %d AND LOWER(name) LIKE LOWER('%%%s%%')", $vid, $last_string, 0, 10);
+    $result = db_query_range(db_rewrite_sql("SELECT t.tid, t.name FROM {term_data} t WHERE t.vid = %d AND LOWER(t.name) LIKE LOWER('%%%s%%')", 't', 'tid'), $vid, $last_string, 0, 10);
 
     $prefix = count($array) ? implode(', ', $array) .', ' : '';
 
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 24df32228460..c2920a7c03a9 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -1369,7 +1369,7 @@ function taxonomy_autocomplete($vid, $string = '') {
   // Fetch last tag
   $last_string = trim(array_pop($array));
   if ($last_string != '') {
-    $result = db_query_range("SELECT name FROM {term_data} WHERE vid = %d AND LOWER(name) LIKE LOWER('%%%s%%')", $vid, $last_string, 0, 10);
+    $result = db_query_range(db_rewrite_sql("SELECT t.tid, t.name FROM {term_data} t WHERE t.vid = %d AND LOWER(t.name) LIKE LOWER('%%%s%%')", 't', 'tid'), $vid, $last_string, 0, 10);
 
     $prefix = count($array) ? implode(', ', $array) .', ' : '';
 
-- 
GitLab