Re: Bugs in PEAR::DB

From: Date: Thu, 12 Jul 2001 22:02:15 +0000
Subject: Re: Bugs in PEAR::DB
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-687@lists.php.net to get a copy of this message
At 12:47 AM +0300 7/13/01, yavo wrote:
I find it hard to use numRows after using getAll/getAssoc can somthing be done about it, the db object only allows numRows if you pass it the result object. for exmaple this
    $sql = "SELECT * FROM SOMETABLE";
    $res = $db->query($sql);
    $data = $db->getAll($sql);
    $rows = $res->numRows();
would work but it's not the most elegant way to do it :) . Any ideas. Maybe have a getLastResult method could help.
If PEAR::DB acts like other DB-access interfaces, this is because the number of rows is available only while the result set object is active, and for these shortcut methods the object has already been disposed of by the time the method returns. A typical workaround for other interfaces is to get the size of the result set from the size of the data structure returned by the method. Can you do that?
yavor
-- Paul DuBois, paul@snake.net

« previous php.pear.dev (#687) next »