diff options
author | Urban Müller | 2019-05-16 18:40:21 +0200 |
---|---|---|
committer | Urban Müller | 2019-05-16 18:40:21 +0200 |
commit | 59d4b9d393baa1e0e62ba67a7ecda9c1d4607a7a (patch) | |
tree | 408aff8b00d8a2eef65d41a33f6b25ac6a0cd50e /it_dbi.class | |
parent | 3680fe1c0f017ca753441228176c401f2626e750 (diff) | |
download | itools-59d4b9d393baa1e0e62ba67a7ecda9c1d4607a7a.tar.gz itools-59d4b9d393baa1e0e62ba67a7ecda9c1d4607a7a.tar.bz2 itools-59d4b9d393baa1e0e62ba67a7ecda9c1d4607a7a.zip |
show full sql statement on readback errs
Diffstat (limited to 'it_dbi.class')
-rw-r--r-- | it_dbi.class | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/it_dbi.class b/it_dbi.class index c995d55..3c414f0 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -450,7 +450,7 @@ function _where($params) /** * Internal: Output class name::error message and terminate execution. */ -function _fatal($text) +function _fatal($text, $body = null) { $text = get_class($this).'::'.$text; @@ -460,7 +460,7 @@ function _fatal($text) if ($this->_link && ($res = @mysqli_fetch_row(mysqli_query($this->_link, 'select database()')))) # dont create extra errs $text .= ", DB: " . $res[0]; - it::fatal($text . ", Server: " . $this->_p['server']); + it::fatal(['title' => $text . ", Server: " . $this->_p['server'], 'body' => $body]); /* NOT REACHED */ } @@ -761,11 +761,11 @@ function insert($tags = array(), $command = "INSERT") $set = $this->_set($tags, "insert"); - if ($result = $this->query("$command INTO {$this->_p['table']} " . $set)) + if ($result = $this->query($query = "$command INTO {$this->_p['table']} " . $set)) { $id = ($this->_p['autoincrement'] && !isset($tags[$this->_p['keyfield']])) ? mysqli_insert_id($this->_link) : $tags[$this->_p['keyfield']]; if ($this->_p['keyfield'] && !$this->read($id) && $this->_p['safety']) - $this->_fatal("insert(): can't read record back (key truncated?), id=\"$id\""); + $this->_fatal("insert(): can't read record back (key truncated?), id=\"$id\"", $query); $this->_touchedids[$this->_key] = true; } |