03-27-2021, 05:14 AM
Dear CI fellows;
I'm using CI4.11. I'm not sure is this the correct place to report this...
I've found that there is no hints at all for an SQL UPDATE statement when using $db->query('UPDATE...'). The return value of $db->query() is always an instance of CodeIgniter\Database\MySQLi\Result, and calling of $db->affectedRows() ALWAYS return -1, no matter update successfully or no record to be updated (such as purposely delete the record ).
In addition, calling of $query->hasError() always failed with:
Is this a bug or have I overlooked somethings...?
Whereas, when using Query Builder or Model's update(), then $db->affectedRows() work correctly. However, calling of $this->update() or $builder->update() ALWAYS return true, even no record has found to be updated. According to documentation, it supposes to return false on failure.
Any idea?
Thanks.
I'm using CI4.11. I'm not sure is this the correct place to report this...
I've found that there is no hints at all for an SQL UPDATE statement when using $db->query('UPDATE...'). The return value of $db->query() is always an instance of CodeIgniter\Database\MySQLi\Result, and calling of $db->affectedRows() ALWAYS return -1, no matter update successfully or no record to be updated (such as purposely delete the record ).
In addition, calling of $query->hasError() always failed with:
Code:
Call to undefined method CodeIgniter\Database\MySQLi\Result::hasError()
Is this a bug or have I overlooked somethings...?
Whereas, when using Query Builder or Model's update(), then $db->affectedRows() work correctly. However, calling of $this->update() or $builder->update() ALWAYS return true, even no record has found to be updated. According to documentation, it supposes to return false on failure.
Any idea?
Thanks.