Skip site navigation (1) Skip section navigation (2)

Re: [INTERFACES] Perl Interface

From: James Olin Oden <joden(at)lee(dot)k12(dot)nc(dot)us>
To: robert_hiltibidal_at_cms08405(at)ccmailgw(dot)state(dot)il(dot)us
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] Perl Interface
Date: 1999-06-22 20:37:04
Message-ID: 376FF3EF.C450B29B@lee.k12.nc.us (view raw or flat)
Thread:
Lists: pgsql-interfaces
robert_hiltibidal_at_cms08405(at)ccmailgw(dot)state(dot)il(dot)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

In response to

pgsql-interfaces by date

Next:From: herouth maozDate: 1999-06-22 21:12:51
Subject: Re: JDBC:Using Large Objects
Previous:From: robert_hiltibidal_at_cms08405Date: 1999-06-22 19:44:48
Subject: Re[2]: [INTERFACES] Perl Interface

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group