RE: [PEAR] Problem using PEAR::DB
| From: | Lukas Smith | Date: | Sat, 27 Sep 2003 10:57:18 +0000 |
| Subject: | RE: [PEAR] Problem using PEAR::DB | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8091@lists.php.net to get a copy of this message | ||
> From: Martin Marques [mailto:martin@bugs.unl.edu.ar]
> Sent: Saturday, September 27, 2003 12:38 PM
> El Vie 26 Sep 2003 16:24, Lukas Smith escribió:
> > > From: Martin Marques [mailto:martin@bugs.unl.edu.ar]
> > > Sent: Friday, September 26, 2003 9:18 PM
> > >
> > > Not only commertial databases support it. PostgreSQL too!
> >
> > Ah sorry I was referring more about a clean integration into the php
> > ext.
> > Both Frontbase and MSSQL ext have the ability to then move from one
> > result set to the next to read the results
>
> I don't get it. I thought it was aboult sending multiple queries in
one
> $db->query(), and let the database engine execute them one after the
> other.
>
> Did I miss understand the problem?
Well being able to send multiple queries is one thing, but being able to
read the results of the query are another. However I think it makes few
sense to be able to send queries for which you never get a result back.
Well I am pondering the suggestion a bit. Maybe with a separate method
like batchQuery() it could be feasible.
batchQuery would either split the query up and send it one by one or
send the batch query in one bulk if supported
batchQuery would return an array like the following:
$batch_result = array(
'current' => 0,
0 => $result_of_query1
1 => $result_of_query2
);
or if the rdbms supports xxx_next_result natively
$batch_result = array(
'current' => 0,
0 => $result
);
you could then call:
$result = $db->nextResult($batch_result);
and then use the $result anyway you wish
hmm maybe a better solution would be to chain the resources in a list.
This would require storing the result list outside of the resource
similar how its done in the num_rows property. That why the behavoir of
xxx_next_result could be emulated even better.
I looked at the phpmyadmin code and found the relevant section, but
phpmyadmin code is god aweful ugly.
BTW: if you are just after the convenience, dont care about the return
values then you can already use executeMultiple.
regards,
Lukas