Well, I have been using $result->getvalue up to now, and individually
accessing records in my databases, but I thought I would try the 'easy'
way now. So much for that idea...
I took this example script, (taken from the 'perldoc pg') and ran it,
but get no results no matter what. (It actually comes from a much
bigger script of course)
The search returns results when executed directly, but via Pg::doQuery I
seem to never get any results.. is it a flaw in the documented example?
I had thought it might be the use of LIKE vs ~ at first, but after
sorting that all out I realized that it was never returning anything,
unless I have made a stupid syntax error that I am too blind to
see.....(nawww... that never happens...)
----<pasted>------
#!/usr/bin/perl
#
# List By Alphabet
# This script takes a look at all clients in the
# database 'people' and allows it to be updated.
#
###########################################################################
# Variable List
#
use Pg;
$conn=Pg::connectdb("dbname=people");
###########################################################################
Pg::doQuery($conn,"SELECT id,firstname,lastname,company
FROM clients
# WHERE lastname ~ '$sortby'
# OR lastname ~ 'lower($sortby)'
# ORDER BY lastname ASC
", \@clients);
# TEST SECTION
for $i (0 .. $#clients) {
for $j (0 .. $#{$clients[$i]} ) {
print "$clients[$i][$j]\t";
}
}
# END TEST SECTION
print @clients;