Re: moving from mySQL to pgsql, need a bit of help (perl)

Поиск
Список
Период
Сортировка
От Peter Haworth
Тема Re: moving from mySQL to pgsql, need a bit of help (perl)
Дата
Msg-id ML-3.4.963318699.886.pmh@edison.ioppublishing.com
обсуждение исходный текст
Ответ на Re: moving from mySQL to pgsql, need a bit of help (perl)  (Ed Loehr <eloehr@austin.rr.com>)
Список pgsql-general
Ed Loehrwrote:
> I believe DBI/DBD does this for you:
>
> while ($row_href = $sth->fetchrow_hashref)
> {
>    push( @taghash, $row_href);
> }

Don't do that! Each hashref in that array will point to the same hash in some
future version of the DBI. You should do this instead:

  while($row=$sth->fetchrow_hashref){
    push @taghash,{%$row};
  }

Or, better yet:

  $taghash=$sth->fetchall_arrayref({});

to get everything all in one go.

--
    Peter Haworth    pmh@edison.ioppublishing.com
"Master, does Emacs have the Buddha nature?" the novice asked.
The Chief Priest had been in the temple for many years and could be
relied upon to know these things.  He thought for several minutes before
replying, "I don't see why not.  It's got bloody well everything else."


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

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: Re: Slashdot discussion
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Slashdot discussion