Instead of this sql query

  $sql = "SELECT * FROM {term_data} WHERE vid = %d";
  $result = db_query($sql, $vid);

  // Look for a term with the same name based on case-sensitivity preferences
  $case_sensitive = variable_get('taxonomy_dupecheck_case_sensitive', 0);
  while ($found_term = db_fetch_object($result)) {

    // Skip the check if the current found term is the same term we're comparing.
    // This will happen on updates to an existing term.
    if ($tid == $found_term->tid) {
      continue;
    }

do sg like this:

  $sql = "SELECT * FROM {term_data} WHERE vid = %d AND name = '".$term."';
...

There is no need to get the entire vocabulary. Just check if we have a record.

Comments

kziv’s picture

Assigned: Unassigned » kziv
Category: bug » task

Changing to task, as functionality is not broken.

kziv’s picture

Status: Active » Fixed

This has been optimized in both 6.x and 7.x dev releases. Feel free to play with it and give some feedback. I'll move it to an official release in a couple weeks. Thanks for the suggestion!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

clarify