Commit 60b70546 authored by Alexander Butenko's avatar Alexander Butenko

issue #375. onDuplicate returns false when there was no change in data

parent 28788081
......@@ -1035,12 +1035,17 @@ class MysqliDb
$this->_query = $operation . " " . implode(' ', $this->_queryOptions) . " INTO " . self::$prefix . $tableName;
$stmt = $this->_buildQuery(null, $insertData);
$stmt->execute();
$status = $stmt->execute();
$this->_stmtError = $stmt->error;
$haveOnDuplicate = !empty ($this->_updateColumns);
$this->reset();
$this->count = $stmt->affected_rows;
if ($stmt->affected_rows < 1) {
// in case of onDuplicate() usage, if no rows were inserted
if ($status && $haveOnDuplicate) {
return true;
}
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment