Re: perl use of cursors and fetch forward - Mailing list pgsql-general

From John Frank
Subject Re: perl use of cursors and fetch forward
Date
Msg-id Pine.LNX.4.30.0101291153300.4035-100000@segovia.mit.edu
Whole thread Raw
In response to perl use of cursors and fetch forward  (John Frank <jrf@segovia.mit.edu>)
Responses Re: Re: perl use of cursors and fetch forward
List pgsql-general
dooh.  never mind.

this works if the "begin work;" and "declare ...;" are in separate exec
requests.



On Mon, 29 Jan 2001, John Frank wrote:

>
> Can someone tell me how to use Postgres cursors through perl?  A sample is
> below.  Is there some way to keep the transaction active between
> $conn-exec calls?
>
> #!/usr/local/bin/perl
> use Pg;
> my $conn = Pg::connectdb("dbname = test");
>
> my $result = $conn->exec("begin work; declare c1 cursor for select fld1
> from tbl1 ; ");
>
> $result = $conn->exec("fetch forward 1 in c1;");
> print "Hurray, I fetched a row: " . $result->fetchrow . "\n";
>
> $result = $conn->exec("end work;");
>
>
>
> jrf@roog:~/$ perl test_cursor.pl
> NOTICE:  PerformPortalFetch: portal "c1" not found
> Hurray, I fetched a row:
> NOTICE:  COMMIT: no transaction in progress
> jrf@roog:~/$
>
>
>
>
>
>


pgsql-general by date:

Previous
From:
Date:
Subject: re : Casting macaddr types to text
Next
From: Konstantinos Agouros
Date:
Subject: plpgsql-function returning a table?