From 95874fae89a13d546be7374e955e6552abc87bb5 Mon Sep 17 00:00:00 2001 From: Thomas BrĂ¼derli Date: Tue, 27 Jul 2010 06:20:57 +0000 Subject: Don't attempt to read record after insert if no keyfield is defined. This prevents from fatal errors on tables without a primary key --- it_dbi.class | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'it_dbi.class') diff --git a/it_dbi.class b/it_dbi.class index 368045b..3ca2fc1 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -625,7 +625,7 @@ function insert($tags = array(), $command = "INSERT") if ($result = $this->query("$command INTO {$this->_p['table']} " . $set)) { $id = ($this->_p['autoincrement'] && !isset($tags[$this->_p['keyfield']])) ? mysql_insert_id($this->_link) : $tags[$this->_p['keyfield']]; - if (!$this->read($id) && $this->_p['safety']) + if ($this->_p['keyfield'] && !$this->read($id) && $this->_p['safety']) $this->_fatal("insert(): can't read record back (key truncated?), id=\"$id\""); } else -- cgit v1.2.3