Re: from pgsql_perl5 to DBD-Pg



.... The previous post formatted like hell. Let see if this does it...

# 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

.



Relevant Pages

  • Re: SQL Query Quandry
    ... Chris Hohmann wrote in message ... > I don't know how the hell you could make something out of my ramblings ... > SQL handbook') and neither gives me any clue on how to do the things ... There's no real black magic in the query I provided. ...
    (microsoft.public.inetserver.asp.db)
  • Re: SQL Query Quandry
    ... > I don't know how the hell you could make something out of my ramblings ... > SQL handbook') and neither gives me any clue on how to do the things ... There's no real black magic in the query I provided. ...
    (microsoft.public.inetserver.asp.db)
  • Mysterious problem with INSERT query
    ... I am having a hell of a time with what I think is a very simple query: ... Query generated by phpMyAdmin and pasted into my PHP doesn't work ...
    (comp.lang.php)
  • Re: from pgsql_perl5 to DBD-Pg
    ... # Returns the number of records in the query result: ... # in the same code structure, but the reason is not clear. ... Print all the records in an intelligent manner: ...
    (perl.dbi.users)