- Edited
Somebody decided that CodeIgniter4's database functionality had no need for a num_rows function like mysqli_num_rows, pg_num_rows, and sqlsrv_num_rows. This dev claims that the presence of such a function causes performance issues without specifying what they might be.
From what I can tell, there are numerous DBMSes that don't offer such a function (e.g., Oracle, SQLite) but this seems like a poor decision to me. I'd be willing to bet that the vast majority of CodeIgniter projects use MySQLi, Postgres, or SQLSRV. Furthermore, it should be almost trivial to expose this function for this DBMS modules that do have such a function and throw an exception for those that don't.
Can anyone tell me if those num_rows functions cause additional communication with the db server or whether they just check an integer in memory? I was under the (perhaps incorrect) impression that a SELECT query in PHP would contact the db server and that all records corresponding to the select query would be copied to PHP memory space. I tried looking up the source code for mysqli_num_rows and did manage to pick thru the macro definitions to this spot in the code, but I can't really figure out what it's going. Looks to me like it might be accessing a struct -- a very quick operatio -- but my C/C++ knowledge has me stumped here.