Index: branches/unlabeled/unlabeled-1.35.2/kernel/include/itemdb.php =================================================================== diff -u -r7837 -r7880 --- branches/unlabeled/unlabeled-1.35.2/kernel/include/itemdb.php (.../itemdb.php) (revision 7837) +++ branches/unlabeled/unlabeled-1.35.2/kernel/include/itemdb.php (.../itemdb.php) (revision 7880) @@ -371,7 +371,7 @@ { global $Errors; - $sql = "INSERT INTO ".$this->tablename." ("; + $sql = "INSERT IGNORE INTO ".$this->tablename." ("; $first = 1; foreach ($this->Data as $key => $value) { @@ -654,28 +654,18 @@ function TableExists($table = null) { - static $tables_found = Array (); - - if ($table == null) $table = $this->tablename; - - if (!isset($tables_found[$table])) { // checks if table specified in item exists in db $db =& GetADODBConnection(); $sql = "SHOW TABLES LIKE '%s'"; - + if($table == null) $table = $this->tablename; $rs = $db->Execute( sprintf($sql, $table) ); - if ($rs->RecordCount() == 1) { - // table exists in normal case - $tables_found[$table] = 1; - } - else { - // check if table exists in lowercase + + if( $rs->RecordCount() == 1 ) // table exists in normal case + return 1; + else // check if table exists in lowercase $rs = $db->Execute( sprintf($sql, strtolower($table) ) ); - $tables_found[$table] = $rs->RecordCount() == 1 ? 1 : 0; - } - } - return $tables_found[$table]; + return ($rs->RecordCount() == 1) ? 1 : 0; } function raiseEvent($name, $id = null)