Welcome Guest, Not a member yet? Register   Sign In
Bug in count_all() and count_all_results()
#3

[eluser]voidstar[/eluser]
I understand your concern, but...
- A quick survey of the methods in the Active Record class reveals that they call $this->query() to actually perform the database operation. $this->query() can return FALSE, and in most cases ( except count_all() and count_all_results() ) this boolean is returned to the application. Asking the caller of the count_all() and count_all_results() methods to check for FALSE is no different from asking him to check the return code from any other active record method.
- Without this fix the developer knows that there's been an error, but he has no idea what it is. The resulting error message and stack dump are not pretty.

Fatal error: Call to a member function num_rows() on a non-object in C:\xampp\htdocs\CodeIgniter_1.7.0\system\database\drivers\mysql\mysql_driver.php on line 332

With this fix the caller can at least retrieve the MySQL error message and get some useful information, e.g.

Table 'codeigniter.xxx' doesn't exist


Messages In This Thread
Bug in count_all() and count_all_results() - by El Forum - 01-11-2009, 10:17 PM
Bug in count_all() and count_all_results() - by El Forum - 01-12-2009, 10:53 AM
Bug in count_all() and count_all_results() - by El Forum - 01-12-2009, 12:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB