#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "\n";
print "
\n";
print "Test of S.u.S.E. Linux 5.3 PostgreSQL access(DBD::Pg)\n";
print "\n";
print "\n";
print "Test of S.u.S.E. Linux 5.3 PostgreSQL access(DBD::Pg)
\n";
use Pg;
$con = Pg::connectdb("dbname=mypsqldb user=postgres");
$sql = "select * from mypsqltable";
$res = $con->exec($sql);
$rownum = $res->ntuples;
$colnum = $res->nfields;
print "\n";
print "\n";
for($i=0;$i<$colnum;$i++){
print "".$res->fname($i)." | \n";
}
print "
\n";
for($i=0;$i<$rownum;$i++){
print "\n";
for($j=0;$j<$colnum;$j++){
$coldata = $res->getvalue($i, $j);
print "$coldata"."
| \n";
}
print "
\n";
}
print "
\n";
print "\n";
print "\n";