Bug #5383 [Opn]: Misleading docs for DataObject->query()?
| From: | pear at bluefish dot co dot uk | Date: | Tue, 13 Sep 2005 13:07:50 +0000 |
| Subject: | Bug #5383 [Opn]: Misleading docs for DataObject->query()? | ||
| References: | 1 | Groups: | php.pear.doc |
| Request: | Send a blank email to pear-doc+get-6804@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=5383&edit=1
ID: 5383
User updated by: pear at bluefish dot co dot uk
-Summary: Misleading docs?
Reported By: pear at bluefish dot co dot uk
Status: Open
Id: 5383
Type: Bug
Package: Documentation
Operating System: win 2k sp4
-PHP Version: 5.1.0
+PHP Version: 5.1.0 RC1
New Comment:
Changed summary to be more specific
Previous Comments:
------------------------------------------------------------------------
[2005-09-13 09:04:46] pear at bluefish dot co dot uk
Description:
------------
http://pear.php.net/manual/en/package.database.db-dataobject.db-dataobject.query.php
says you should do a find() after a query()
After eventually realising that no matter what the query was that it
was returning everything, I removed the find() and it worked.
Is this a problem with the docs or with query()/find()?
Test script:
---------------
$speaker = new DBO_Speaker;
$speaker->query("
SELECT * FROM speaker WHERE id=23
");
$speaker->find();
$array = array();
while ($speaker->fetch()) {
$array[] = clone($speaker);
}
return $array;
Expected result:
----------------
finds nothing
Actual result:
--------------
DBO_Speaker: QUERY: SELECT * FROM speaker WHERE id=23
DBO_Speaker: query: QUERY DONE IN 0.00082302093505859 seconds
DBO_Speaker: __find:
DBO_Speaker: QUERY: SELECT * FROM speaker
DBO_Speaker: query: QUERY DONE IN 0.00066304206848145 seconds
DBO_Speaker: __find: CHECK autofetchd
DBO_Speaker: __find: DONE
DBO_Speaker: FETCH:
a:5:{s:2:"id";s:1:"1";s:5:"title";s:2:"Mr";s:9:"firstname";s:6:"Shimon";s:10:"middlename";s:11:"Marc
Joseph";s:7:"surname";s:5:"Young";}
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=5383&edit=1