On Thu, Apr 2, 2009 at 7:05 PM, Sam Mason <sam@xxxxxxxxxxxxx> wrote: > On Thu, Apr 02, 2009 at 09:48:33PM +0200, Ivan Sergio Borgonovo wrote: >> I didn't find any elegant example of cursor use in PHP... OK PHP is >> not the most elegant language around... but still any good exapmle >> someone could point me at? > > I don't program PHP; but my guess would be something like: > > pg_query("BEGIN;"); > pg_query("DECLARE cur CURSOR FOR SELECT * FROM t1;"); > while (pg_num_rows($result = pg_query("FETCH 1000 FROM cur;")) > 0) { > while($row = pg_fetch_array($result)) { > } > } > pg_query("COMMIT;"); I've done something similar and it worked just fine. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general