Re: pg_exec
| From: | The Hermit Hacker | Date: | Sat, 03 Mar 2001 02:29:13 +0000 |
| Subject: | Re: pg_exec | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-7090@lists.php.net to get a copy of this message | ||
first, it returns all the results at once ... to do otherwise, you'd have
to use CURSORS, which I don't believe PHP supports at this time ...
but, am curious as to why the multiple loops requirement?
On Fri, 2 Mar 2001, dime wrote:
> I have been wondering this for a while and finally have the chance to ask. What I'm
> trying to do is select a bunch of names from one table in a postgresql database. The way I'd
> like to display them is alphabetically and indexed by the first letter. So they look similar to
> this:
>
> A
> Alexandria, Mark
> Angel, Chris
> B
> Boy, John
> C
> ....
>
> I know a couple ways to do it, but every way involves multiple queries. What I'm
> wondering is when I issue a select statement to the database via pg_exec(), is the result loaded
> into memory then, or when each successive pg_fetch_array() is called? I mean, it seems like if each
> pg_fetch_array were making a call to the database, that would be an unnecassary overhead on a list
> that has a lot of names. But however, if the entire result set is in the webserver's memory,
> then I don't really have a problem with doing multiple loops through the data. Hopefully
> I've described my problem adequately. If any one can help, or has a better idea, please let me
> know.
>
> Thank You.
>
> dime
>
>
Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org