spi_query/spi_fetchrow for pl/perl

Lists: pgsql-patches
From: Abhijit Menon-Sen <ams(at)oryx(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Cc: plperlng-devel(at)pgfoundry(dot)org
Subject: spi_query/spi_fetchrow for pl/perl
Date: 2005-06-29 09:47:31
Message-ID: 20050629094731.GA21828@penne.toroid.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

The attached patch implements spi_query() and spi_fetchrow() functions
for PL/Perl, to avoid loading the entire result set into memory as the
existing spi_exec_query() function does.

Here's how one might use the new functions:

$x = spi_query("select ...");
while (defined ($y = spi_fetchrow($x))) {
...
return_next(...);
}

The changes do not affect the spi_exec_query() interface in any way.

Comments welcome.

-- ams

Attachment Content-Type Size
spi-query.diff text/plain 3.9 KB

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Abhijit Menon-Sen <ams(at)oryx(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, plperlng-devel(at)pgfoundry(dot)org
Subject: Re: spi_query/spi_fetchrow for pl/perl
Date: 2005-07-10 15:19:47
Message-ID: 200507101519.j6AFJlX27719@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Patch applied. Thanks.

---------------------------------------------------------------------------

Abhijit Menon-Sen wrote:
> The attached patch implements spi_query() and spi_fetchrow() functions
> for PL/Perl, to avoid loading the entire result set into memory as the
> existing spi_exec_query() function does.
>
> Here's how one might use the new functions:
>
> $x = spi_query("select ...");
> while (defined ($y = spi_fetchrow($x))) {
> ...
> return_next(...);
> }
>
> The changes do not affect the spi_exec_query() interface in any way.
>
> Comments welcome.
>
> -- ams

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073