From d58ddd99991b13ef37adf7c51f9f1505a33cec84 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 27 Apr 2008 20:05:04 +0000 Subject: [PATCH] "allow to insert rows with the auto-id specified" --- etemplate/inc/class.so_sql.inc.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/etemplate/inc/class.so_sql.inc.php b/etemplate/inc/class.so_sql.inc.php index 42fa367744..d347330a9c 100644 --- a/etemplate/inc/class.so_sql.inc.php +++ b/etemplate/inc/class.so_sql.inc.php @@ -489,14 +489,11 @@ class so_sql $data = $keys; $keys = False; } - if (!$this->autoinc_id) // always try an insert if we have no autoinc_id, as we dont know if the data exists + // always try an insert if we have no autoinc_id, as we dont know if the data exists + if (!$this->autoinc_id || !$this->db->update($this->table_name,$data,$keys,__LINE__,__FILE__,$this->app) || !$this->db->affected_rows()) { $this->db->insert($this->table_name,$data,$keys,__LINE__,__FILE__,$this->app); } - else - { - $this->db->update($this->table_name,$data,$keys,__LINE__,__FILE__,$this->app); - } } $this->db2data();