From c34dc5563312f41abf9728f181b8b74eae373018 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 30 May 2008 08:20:06 +0000 Subject: [PATCH] "fixing the fix: only add primary key, if it's NOT an auto id" --- etemplate/inc/class.so_sql.inc.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/etemplate/inc/class.so_sql.inc.php b/etemplate/inc/class.so_sql.inc.php index 82c699c1ee..5286425a0e 100644 --- a/etemplate/inc/class.so_sql.inc.php +++ b/etemplate/inc/class.so_sql.inc.php @@ -951,7 +951,13 @@ class so_sql $data = $this->data; } $n = 1; - foreach(array_merge($this->db_uni_cols,array($this->db_key_cols)) as $db_col => $col) + $uni_keys = $this->db_uni_cols; + // add the primary key, only if it's NOT an auto id + if (!$this->autoinc_id) + { + $uni_keys[] = $this->db_key_cols; + } + foreach($uni_keys as $db_col => $col) { if (is_array($col)) { @@ -971,9 +977,9 @@ class so_sql { if ($data[$key_col] != $other[$key_col]) { - if ((int) $this->debug >= 4) + //if ((int) $this->debug >= 4) { - echo "

not_unique in '$col' as for '$key_col': '${data[$key_col]}' != '${other[$key_col]}'

\n"; + echo "

not_unique in ".array2string($col)." as for '$key_col': '${data[$key_col]}' != '${other[$key_col]}'

\n"; } return $n; // different entry => $n not unique }