From: | "Gene Selkov Jr(dot)" <selkovjr(at)mcs(dot)anl(dot)gov> |
---|---|
To: | david(at)tte(dot)tamu(dot)edu, pgsql-interfaces(at)postgresql(dot)org |
Subject: | Re: [INTERFACES] Dereferencing PG_Result |
Date: | 1998-11-23 23:08:23 |
Message-ID: | 199811232306.RAA23573@antares.mcs.anl.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
> Here's the code:
>
> #!/usr/bin/perl
>
> use Pg
>
> $conn = Pg::connectdb("dbname = mydb");
> $result = $conn->exec("select * from mytable");
>
> print $result "\n";
>
> ----end code---
>
> This is what's returned:
>
> PG_results=SCALAR(0x8110e14)
>
> ----end result-----
> Mydb has a table mytable with a field myfield. There are two tuples.
>
> Question: How can I deference the pointer to get at the actual data?
if ( $result->ntuples > 0 ) {
for $i ( 0 .. $result->ntuples - 1 ) {
my ( $field1, $field2 ) = ($result->getvalue($i, 0), $result->getvalue($i, 1));
....
}
}
--Gene
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas G. Lockhart | 1998-11-24 02:40:32 | Re: [INTERFACES] FW: POSTOBDC |
Previous Message | REDCYT - Juan Carlos Liendro | 1998-11-23 19:43:07 | Problem Applet-Appletviewer |