Re: from pgsql_perl5 to DBD-Pg

Bob Hunter <catdogbeloved-/[email protected]>
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
# How to port code from Pg.pm [1] to DBD::Pg.pm [2].
#
# Tested and working thus far:
#
# [1]: $dbh = Pg::connectdb("dbname=$dbname");
# [2]: $dbh = DBI->connect("DBI:Pg:dbname=$dbname",
"", "", {AutoCommit => 1});
#
# [1]: $dbh->exec("<SQL STATEMENT>");
# [2]: $dbh->do("<SQL STATEMENT>"); # non select
# [2]: $sth = $dbg->prepare("<SQL STATEMENT>");
$sth->execute; # select
#
# [1]: $dbh->status == 0
# [2]: (not defined $dbh->errstr)
#
# Returns the number of records in the query result:
# [1]: $sth->ntuples
# [2]: $sth->rows
#
# Returns the number of fields in the query result:
# [1]: $sth->nfields
# [2]: $sth->{NUM_OF_FIELDS}
#
# Returns the field name associated with the given
field number:
# [1]  $sth->fname($i)
# [2]: $sth->{NAME}->[$i]
#
# Pending solution thus far:
#
# Prints out all the records in an intelligent manner:
# [1]:
$sth->print($fout,$header,$align,$standard,$html3,$expanded,$pager,$fieldSep,
$tableOpt, $caption)
# [2]: N.A. 

Bob



 
____________________________________________________________________________________
Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.