Re: Fetching PEAR DB in a set
| From: | Sanjay | Date: | Mon, 22 Dec 2003 23:23:21 +0000 |
| Subject: | Re: Fetching PEAR DB in a set | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9783@lists.php.net to get a copy of this message | ||
Thanks Graham,
I have looked PEAR DB manual and also MDB documentation. I have seen methods
to get one row or all rows.
I know, I can loop thru recordset without any problems but what I am asking
is different.
1. Suppose, If I execute a query which returns 1 million records, so I can
do DB_Common::getRow() -- fetch the first row or do DB_Common::getAll() --
Fetch all rows , how is memory handling, if I do DB_Common::getAll. I
don't know how is memory handled in getAll case . Will it create memory
problems when data is very big.
2. The method which mentioned above, gives fetch 1 row or all rows but what
I want is to fetch in batches, in oracle terms, it is called array Fetch or
Bulk Fetch (PLSQL) and I can define how many records, I want to fetch at one
time so e.g. if I query returns 1000 records and if I say in one fetch
return 100 recors so there will be just 10 trips to fetch all data so my
question is how can I do this in PEAR DB or MDB
Sanjay
----- Original Message -----
From: "Graham Clarke" <grahamc@53tech.com>
To: "Sanjay" <sanjay92@hotmail.com>; <pear-general@lists.php.net>
Sent: Monday, December 22, 2003 4:46 PM
Subject: Re: [PEAR] Fetching PEAR DB in a set
> Check the docs on pear.php.net for best description -- you have choices
>
> $result = _however_you_get_your_PEAR::DB_recordset()
>
> // this creates an indexed array $my_data where each row is an associative
> array w/ keys = column names
> while ($r = $result->fetchRow(DB_FETCHMODE_ASSOC)) {
>
> $my_data[] = $r;
>
> }
>
> At 09:26 AM 12/22/2003 -0800, Sanjay wrote:
> >How do I fetch say 20 records at a time. I am using Oracle database.
> >Suppose my query returns 1000 records but I want to fetch 20 records at
on
> >time and then display these 20 records on your page and then you keep
> >fetching next 20 records and so on.. How should I do it in PEAR DB.
> >
> >Thanks
> >Sanjay
>
>
> Graham Clarke
> GrahamC@53Tech.com
> www.53Tech.com
> 603.643.9955
>
>