Re: cursores

Поиск
Список
Период
Сортировка
От Vick Khera
Тема Re: cursores
Дата
Msg-id 2968dfd60906030655l6df223e6i8fe0331d6107bb0a@mail.gmail.com
обсуждение исходный текст
Ответ на cursores  ("Esneiker" <eenriquez@cav.desoft.cu>)
Список pgsql-general
On Wed, Jun 3, 2009 at 9:36 AM, Esneiker <eenriquez@cav.desoft.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();

В списке pgsql-general по дате отправления:

Предыдущее
От: Jennifer Trey
Дата:
Сообщение: High I/O writes activity on disks causing images on browser to lag and not load
Следующее
От: Grzegorz Jaśkiewicz
Дата:
Сообщение: Re: High I/O writes activity on disks causing images on browser to lag and not load