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

 ID:                 49303
 Comment by:         gudjonj at gmail dot com
 Reported by:        rene at 809estudio dot com
 Summary:            SQLite3::numRows() not implemented
 Status:             Not a bug
 Type:               Bug
 Package:            SQLite related
 Operating System:   Windows Vista Home Premium
 PHP Version:        5.3.0
 Block user comment: N
 Private report:     N

 New Comment:

I am having trouble with this as well.


Previous Comments:
------------------------------------------------------------------------
[2009-08-21 01:55:16] rene at 809estudio dot com

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.

------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=49303&edit=1

Reply via email to