diff options
author | Thomas BrĂ¼derli | 2010-07-27 06:20:57 +0000 |
---|---|---|
committer | Thomas BrĂ¼derli | 2010-07-27 06:20:57 +0000 |
commit | 95874fae89a13d546be7374e955e6552abc87bb5 (patch) | |
tree | 5e25a65b9aca28e9f5df7e2bd4e1129b12cd964c /it_dbi.class | |
parent | ba85ece21f086e87597e6697ba320b3c15b6a45a (diff) | |
download | itools-95874fae89a13d546be7374e955e6552abc87bb5.tar.gz itools-95874fae89a13d546be7374e955e6552abc87bb5.tar.bz2 itools-95874fae89a13d546be7374e955e6552abc87bb5.zip |
Don't attempt to read record after insert if no keyfield is defined. This prevents from fatal errors on tables without a primary key
Diffstat (limited to 'it_dbi.class')
-rw-r--r-- | it_dbi.class | 2 |
1 files changed, 1 insertions, 1 deletions
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 |