Re: from pgsql_perl5 to DBD-Pg



UPDATE

#
# How to port code from Pg [1] to DBI [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
# [2]: @$sth
#
# 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]
#
# Returns the value of the given record and field number:
# [1]: $value = $sth->getvalue($r,$f);
# [2]: $results = $sth->fetchall_arrayref(); $value = $results->[$r]
[$f];
#
# Pending solution thus far:
# --------------------------
#
# 1. There are two possible methods to return the number of records
# in the query result. The method @$sth works where $sth->rows
fails,
# in the same code structure, but the reason is not clear.
#
# 2. Print all the records in an intelligent manner:
# [1]: $sth->print($fout, $header, $align, $standard, $html3,
$expanded, $pager,
$fieldSep, $tableOpt, $caption)
# [2]: open thread at http://groups.google.it/group/perl.dbi.users/browse_thread
/thread/3fa50f7b647ada6d?hl=en
#

.



Relevant Pages

  • RE: Query Problem, Please Help!!
    ... > this table to be laid out the way it is. ... The reason that experts recommend using a query as the Record Source for a ... The query ... will allow the designer to display the data in just about any way needed. ...
    (microsoft.public.access.queries)
  • Re: Issue with order placement...
    ... David's suggestion to use Me.Dirty = False is a good one. ... variable again to re-execute the same query, but I can also tell you this -- ... executing the identical update query to set a field to zero twice in a row ... There is good reason to set ...
    (comp.databases.ms-access)
  • Re: Converting bad table design to good design
    ... There isn't really a whole lot to learn about append queries. ... query) they are queries like any other. ... >> newsgroup, but if you have a good reason to send me e-mail, you'll find ... >>> Category for review ...
    (microsoft.public.access.externaldata)
  • Re: Report Layout for Vertical and Horizontal
    ... Sounds as if you need a Crosstab query as the source for your report. ... your Reason field and at the bottom select group header "Yes" and group ...
    (microsoft.public.access.reports)
  • Re: How can I assign the result of dateadd to a variable ?
    ... The reason why I used text is because the length of the packet_data varies, ... > What bugged me more was the difference in execution time between the query ... > using the text in row option. ... > there will be no rows returned to the client, ...
    (microsoft.public.sqlserver.programming)