summaryrefslogtreecommitdiff
path: root/it_dbi.class
diff options
context:
space:
mode:
Diffstat (limited to 'it_dbi.class')
-rw-r--r--it_dbi.class14
1 files changed, 12 insertions, 2 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 2c71ff5..e4c3e2c 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -48,6 +48,7 @@ class it_dbi
var $_convertfunc; # Array of name => convert function (currently intval and floatval) for this field's values
var $_link; # DB link identifier (private)
var $_dbid; # string identifying db connection. used for _state_purgeshared from outside
+ var $_affectedrows;# Affected rows (mysql_affected_rows() gets clobbered)
/**
@@ -530,6 +531,15 @@ function query($query, $p = array())
it_dbi::_state_purgeshared($dbid);
}
+ $this->_affectedrows = $this->_link->affected_rows; # get_warnings() clobbers this
+ if (($warning = $this->_link->get_warnings()))
+ {
+ do
+ $messages[] = $warning->message;
+ while ($warning->next());
+ it::error('title' => "Mysql warning: " . $messages[0], 'body' => join("\n", $messages) . "\n");
+ }
+
if ($writing && $this->_p['throttle_writes'])
usleep(1000000 * (gettimeofday(true) - $start) * $this->_p['throttle_writes']);
@@ -774,7 +784,7 @@ function update($tags = array(), $where = null)
if ($result = $this->query("UPDATE " . $this->_from($where, true) . " $set " . $this->_where($where)))
{
- $result = mysqli_affected_rows($this->_link);
+ $result = $this->_affectedrows;
if (array_key_exists($this->_p['keyfield'], $tags)) # Did we just update the key?
$this->_key = $tags[$this->_p['keyfield']];
@@ -808,7 +818,7 @@ function delete($query = null)
}
if ($query && $this->query("DELETE " . $this->_from($query) . " " . $this->_where($query)))
- $result = mysqli_affected_rows($this->_link);
+ $result = $this->_affectedrows;
return $result;
}