ID:               49303
 User updated by:  rene at 809estudio dot com
 Reported By:      rene at 809estudio dot com
 Status:           Bogus
 Bug Type:         SQLite related
 Operating System: Windows Vista Home Premium
 PHP Version:      5.3.0
 New Comment:

Ok, I understand the situation, but still, the method is specified in
the PHP documentation and there's even an example in a object oriented
fashion (which I'm sure doesn't even work).

This method should be implemented regardless even as a hack since:

* SQLite1 library supported it. Not implementing it represents a
drawback.
* Every major database library in PHP has a similar function. (SQLite1,
MySQL, MSSQL, PostgreSQL)

Until now I have relied using a COUNT(*) or fetching all the arrays,
storing them and counting them but I don't like neither of these
methods.


Previous Comments:
------------------------------------------------------------------------

[2009-08-20 09:40:40] scott...@php.net

SQLite and SQLite3 have different APIs.

SQLite3 doesn't implement buffered results so the total number of
results isn't available. This is down to the fact that libsqlite really
doesn't implement it either and its emulated by the old SQLite
extension.

------------------------------------------------------------------------

[2009-08-20 06:57:33] rene at 809estudio dot com

Description:
------------
PHP's SQLite library possesed a function called
sqlite_num_rows($result) which would return the number of rows present
in a result from a query. This method is not implemented in the
SQLiteResult class even if the documentation hints that it exists.

http://www.php.net/manual/en/function.sqlite-num-rows.php

This is a core function which should not be overlooked.

Reproduce code:
---------------
<?php
   $db = new SQLite3('databaseName');

   $result = $db->query('SELECT * FROM tableName');

   echo "Number of rows : ".$result->numRows();
?>

Expected result:
----------------
Number of rows: 100

Actual result:
--------------
Fatal error: Call to undefined method SQLite3Result::numRows() in
{file} on line {line}


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=49303&edit=1

Reply via email to