Re: from pgsql_perl5 to DBD-Pg
- From: "Bob" <catdogbeloved@xxxxxxxxx>
- Date: 27 Feb 2007 04:07:17 -0800
Update on how to port code from Pg.pm [1] to DBD::Pg.pm [2]:
[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]
The above has been tested, and works so far.
The following is currently pending:
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.
.
- References:
- from pgsql_perl5 to DBD-Pg
- From: Bob
- from pgsql_perl5 to DBD-Pg
- Prev by Date: Re: DBD::Oracle-1.19 installation error
- Next by Date: Re: from pgsql_perl5 to DBD-Pg
- Previous by thread: Re: from pgsql_perl5 to DBD-Pg
- Next by thread: Re: from pgsql_perl5 to DBD-Pg
- Index(es):