From: | Vick Khera <vivek(at)khera(dot)org> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: cursores |
Date: | 2009-06-03 13:55:41 |
Message-ID: | 2968dfd60906030655l6df223e6i8fe0331d6107bb0a@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Jun 3, 2009 at 9:36 AM, Esneiker <eenriquez(at)cav(dot)desoft(dot)cu> wrote:
> Hello.
>
> I´m trying to build a cursor for postgres but I have some problems. Can
> anybody send me an example of cursor in postgres?
In perl:
$dbh->begin_work();
$dbh->do('DECLARE c1 NO SCROLL CURSOR FOR SELECT user_id,user_email
FROM user_list')
or die;
my $sth = $dbh->prepare("FETCH 1000 FROM c1") or die $dbh->errstr;
while (1) {
$sth->execute() or die $dbh->errstr;
last if ($sth->rows() == 0);
while (my ($uid,$email) = $sth->fetchrow_array()) {
print "$uid $email\n";
}
}
$dbh->commit();
From | Date | Subject | |
---|---|---|---|
Next Message | Grzegorz Jaśkiewicz | 2009-06-03 13:58:29 | Re: High I/O writes activity on disks causing images on browser to lag and not load |
Previous Message | Jennifer Trey | 2009-06-03 13:52:53 | High I/O writes activity on disks causing images on browser to lag and not load |