summaryrefslogtreecommitdiff
path: root/it_dbi.class
diff options
context:
space:
mode:
authorThomas BrĂ¼derli2010-07-27 06:20:57 +0000
committerThomas BrĂ¼derli2010-07-27 06:20:57 +0000
commit95874fae89a13d546be7374e955e6552abc87bb5 (patch)
tree5e25a65b9aca28e9f5df7e2bd4e1129b12cd964c /it_dbi.class
parentba85ece21f086e87597e6697ba320b3c15b6a45a (diff)
downloaditools-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.class2
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