Trying to import taxonomy terms I get this error:

Column not found: 1054 Unknown column 'los_d7_t.vid' in 'where clause': SELECT t.tid FROM {taxonomy_term_data} t INNER JOIN {taxonomy_term_hierarchy} h ON t.tid = h.tid WHERE :name LIKE LOWER(t.name) AND {t.vid} = :vid ORDER BY {t.tid} ASC LIMIT 1; Array ( [:name] => hotel [:vid] => 3 ) in taxonomy_csv_term_find() (line 92 in /var/www/omissis/sites/all/modules/taxonomy_csv/taxonomy_csv.term.api.inc).

The problem is actually at lines 81, 86 and 90. Columns names shouldn't be put into curly brackets.
Removing curly brackets works fine for me.

Comments

holdmann’s picture

To fixing this stuff it's necessary to remove braces in specified lines.

This problem arises when $databases['default']['default']['prefix'] variable is defined.

before:

    if (drupal_strlen($name)) {
      // Only term id is selected, because taxonomy_term_load is used next in
      // order to take advantage of taxonomy cache.
      $sql = "
        SELECT t.tid
        FROM {taxonomy_term_data} t
        INNER JOIN {taxonomy_term_hierarchy} h ON t.tid = h.tid
        WHERE :name LIKE LOWER(t.name)
      ";
      $args = array();
      $args[':name'] = $name;

      if (isset($term->vid)
          && $term->vid
          && !$all_vocabularies) {
        $sql .= ' AND {t.vid} = :vid';
        $args[':vid'] = $term->vid;
      }

      if ($parent_tid) {
        $sql .= ' AND {h.parent} = :parent';
        $args[':parent'] = $parent_tid;
      }

      $sql .= ' ORDER BY {t.tid} ASC LIMIT 1';

      $result = db_query($sql, $args);
      // Only zero or one result.
      foreach ($result as $item) {
        $found_term = taxonomy_term_load($item->tid);
      }
    }
  }

after:

if (drupal_strlen($name)) {
      // Only term id is selected, because taxonomy_term_load is used next in
      // order to take advantage of taxonomy cache.
      $sql = "
        SELECT t.tid
        FROM {taxonomy_term_data} t
        INNER JOIN {taxonomy_term_hierarchy} h ON t.tid = h.tid
        WHERE :name LIKE LOWER(t.name)
      ";
      $args = array();
      $args[':name'] = $name;

      if (isset($term->vid)
          && $term->vid
          && !$all_vocabularies) {
        $sql .= ' AND t.vid = :vid';
        $args[':vid'] = $term->vid;
      }

      if ($parent_tid) {
        $sql .= ' AND h.parent = :parent';
        $args[':parent'] = $parent_tid;
      }

      $sql .= ' ORDER BY t.tid ASC LIMIT 1';

      $result = db_query($sql, $args);
      // Only zero or one result.
      foreach ($result as $item) {
        $found_term = taxonomy_term_load($item->tid);
      }
    }
Daniel_KM’s picture

Version: 7.x-5.6 » 7.x-5.x-dev
Status: Active » Closed (duplicate)

Hi,

Thanks for your patch. This issue is a duplicate of this one. I've just committed it.

Sincerely,

Daniel Berthereau
Infodoc & knowledge management