Re: DB oci8 limitQuery() problem
| From: | Aleksander Kmetec | Date: | Mon, 15 Mar 2004 04:33:46 +0000 |
| Subject: | Re: DB oci8 limitQuery() problem | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-26414@lists.php.net to get a copy of this message | ||
Hello,
Daniel Convissor wrote:
Which database server are you using? Which version of PEAR DB are you using?I'm using Oracle 9.2.0, PHP 4.3.4 and DB 1.6.1 to which I upgraded from 1.6.0 after first experiencing this problem. My previous mail was a bit short on details (well, except the "oci8" bit in subject line) since I was sure about having located the problem and was nearly looking for some feedback on how to implement a patch. But if you feel like writing it yourself, I won't mind. :) Simple table / data / script for reproducing the problem. Just add connection data. -------- $DB = DB::connect("oci8://:@"); $DB->query("CREATE TABLE limittest (abc VARCHAR2(10))"); $DB->query("INSERT INTO limittest VALUES ('first')"); $DB->query("INSERT INTO limittest VALUES ('second')"); $DB->query("INSERT INTO limittest VALUES ('third')"); $DB->query("commit"); $data = $DB->limitQuery("SELECT * FROM limittest WHERE abc= ?",
0, 2, array('first'));
/* should cause fatal error:
Call to undefined function: fetchrow()
*/
while ($row = $data->fetchRow()) {
print_r($row);
echo "<br>";
}
$DB->query("DROP TABLE limittest");
--------
Adding an echo statement after the first line of modifyLimitQuery() in oci8.php outputs:
SELECT * FROM (SELECT * FROM limittest WHERE abc= ?) WHERE NULL = NULL
so this is what also gets sent to the database (and results in an error).
I'm currently in the process of porting a PostgreSQL CMS to Oracle and was manually adding subselects to limit output on Oracle when it accoured to me that this is surely supported by pear db. That's when I stumbled across this error.
The same queries work fine with PostgreSQL module, btw.
Regards, Aleksander