Re: [INTERFACES] Perl Interface - Mailing list pgsql-interfaces

From James Olin Oden
Subject Re: [INTERFACES] Perl Interface
Date
Msg-id 376FF3EF.C450B29B@lee.k12.nc.us
Whole thread Raw
In response to Re[2]: [INTERFACES] Perl Interface  (robert_hiltibidal_at_cms08405@ccmailgw.state.il.us)
Responses Re: [INTERFACES] Perl Interface  ("Gene Selkov, Jr." <joden@lee.k12.nc.us>)
List pgsql-interfaces
robert_hiltibidal_at_cms08405@ccmailgw.state.il.us wrote:
> 
>      Afternoon,
> 
>      intriguing... however, how do I go to the next row? I tried a
>      variation earlier that looked like:
> 
>      while (@row = $result->fetchrow) {
>            $string = join("\|",@row);
>            push(@set,$string);
>      }
>      $result = $conn->getResult;
> 
> 
>      I've also tried :
> 
>      while ($result = $conn->getResult) {
>            while (@row = $result->fetchrow) {
>                   $string = join("\|",@row);
>            }
>            push(@set,$string);
>      }
> 
> 
>      The goal is to get multiple rows into a single array. The answer is
>      probally very simple.
> 
Looks like you caught my "|" error (-;  Seriously, I though the
following should do it:
     while (@row = $result->fetchrow) {           $string = join("\|",@row);           push @set, ($string);     }

If though you wanted to put them in a multidimensional array (well
really a list of references to lists then you would do something like:
     while (@row = $result->fetchrow) {           push @set, (@row);     }

and then you would reference each element like this:
  $set[$i][$j]

or:
  $set[$i]->[$j]

depending on your mood.

...james


pgsql-interfaces by date:

Previous
From: Steffen Zimmert
Date:
Subject: Arrays in PostgreSQL
Next
From: herouth maoz
Date:
Subject: Re: JDBC:Using Large Objects