pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: James Olin Oden <joden@lee.k12.nc.us>
To: robert_hiltibidal_at_cms08405@ccmailgw.state.il.us
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] Perl Interface
Date: Tue, 22 Jun 1999 16:37:04 -0400
Message-ID: <376FF3EF.C450B29B@lee.k12.nc.us> (raw)
References: <9906229300.AA930077109@ccmailgw.state.il.us>

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



view thread (17+ messages)  latest in thread

Message-ID: <376FF3EF.C450B29B@lee.k12.nc.us>
Permalink:  ../376FF3EF.C450B29B@lee.k12.nc.us/
Also on:    postgresql.org/message-id/376FF3EF.C450B29B@lee.k12.nc.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: joden@lee.k12.nc.us, robert_hiltibidal_at_cms08405@ccmailgw.state.il.us
  Subject: Re: [INTERFACES] Perl Interface
  In-Reply-To: <376FF3EF.C450B29B@lee.k12.nc.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox