-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
I'm using an insert statement with onDuplicate. If a user saves a data without anyy changes (record already in the database) the insert returns with bool(false) error. But there is no database error just 0 affected rows with the execution of the query.
Used code:
$data = [
'id' => $id,
'data_1' => $data_1,
'data_2' => $data_2,
];
$db->onDuplicate(['data_1', 'data_2']);
if (!$db->insert('megbizasok_kamionok', $data))
throw new DBException('json');My problem is in the _buildInsert() function:
if ($stmt->affected_rows < 1) {
return false;
}Why is this considered an error when sql error number is 0?
Should I use a different approach?
Metadata
Metadata
Assignees
Labels
No labels