On Tue, 4 Jan 2000, Michelle Leonard wrote:

> So now my question is where are examples/docs on how
> to hook into this using perl instead of pgsql?  I did
> install the postgresql-perl rpm...

You use the module Pg:

-- 8< -- snip --
use Pg;

my $conn;
my @resultarray;
my $row;
my $col;

$conn = PG::connectdb("host=mydbserver dbname=mydatabase");

Pg::doQuery ($conn, "SELECT foo FROM bar WHERE baz=0", \@resultarray);

for $row (0..$#resultarray) {
  for $col (0..$#{$resultarray[$row]}) {
    print $resultarray[$row][$col] . "\t";
  }
  print "\n";
}
-- 8< -- snap

or:

[...]
my $result = PQexec ($conn, "....");
[...]
print $result->getvalue ($row, $col);
[...]

for more info, see 'man Pg' or 'perldoc Pg'.

Nils
-- 
 Nils Philippsen / Berliner Straße 39 / D-71229 Leonberg // +49.7152.209647
[EMAIL PROTECTED] / [EMAIL PROTECTED] / [EMAIL PROTECTED]
   The use of COBOL cripples the mind; its teaching should, therefore, be
   regarded as a criminal offence.                  -- Edsger W. Dijkstra


************
[EMAIL PROTECTED]   http://www.linuxchix.org

Reply via email to