• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI4 $db->query() & Model's update() Issue

#1
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:
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.
Reply

#2
You can always try the CodeIgniter 4 developer version on gethub that's were the bugs are fixed.

CodeIgniter 4 Develop
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
All right. Thanks.  Smile
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.