On Mon, 15 Apr 2002 22:51:49 -0400
"Thomas A. Lowery" <[EMAIL PROTECTED]> wrote:
> On Mon, Apr 15, 2002 at 08:28:24PM -0500, GB Clark wrote:
> > On Mon, 15 Apr 2002 19:10:22 -0400
> > "Thomas A. Lowery" <[EMAIL PROTECTED]> wrote:
> <snip>
> > > On Mon, Apr 15, 2002 at 04:18:08AM -0500, GB Clark wrote:
> > > > Any time I call errstr either as a method or variable
> > > > all I get is the err code. ONE time I did get the right
> > > > string, but for the life of me, I can't figure out why I
> > > > can not get now.
> > > >
> > > > Any ideas?
>
> > [SNIP]
> > $dbh->do($insert);
>
> Check for errors using $dbh->err;
>
> > if($DBI::err) {
> > my $error = $DBI::errstr;
>
> Get the error message from $dbh->errstr;
>
> > CloseDBConnection($dbh);
> > DBError "AddUser - do - $error";
> > }
> > [SNIP]
>
> --
> Thomas A. Lowery
> See DBI/FAQ http://xmlproj.dyndns.org/cgi-bin/fom
>
Hi,
Ok, still a no go..
Here is a compleate snip, maybe it will help.
my $select = qq#
SELECT sitecode
FROM sitelist
WHERE status = 'A'
#;
my $sth = $dbh->prepare($select);
if ($dbh->err) {
my $error = $dbh->errstr;
CloseDBConnection($dbh);
die "GetSites - prepare - $error";
}
# Execute statment
$sth->execute();
if ($sth->err) {
my $error = $sth->errstr;
CloseDBConnection($dbh);
die "GetSites - execute - $error";
}
my @retrow;
while(@retrow = $sth->fetchrow_array()) {
push @$rsites, $retrow[0];
}
$sth->finish();
if ($dbh->err) {
my $error = $dbh->errstr;
CloseDBConnection($dbh);
die "GetSites - finish - $error";
}
Here is the error this returns:
GetSites - execute - 7 at ./gentestdata line 109.
This is due to the fact that status should be sitestatus.
Here is my connection open code, I always default the prameters.
sub OpenDBConnection {
my $AutoCommit = shift || 1;
my $RaiseError = shift || 0;
my $PrintError = shift || 0;
# Open up the DB connection
my %attr = (
RaiseError => $RaiseError,
AutoCommit => $AutoCommit,
PrintError => $PrintError
);
my $data_source = "dbi:Pg:dbname=websales";
# Connect
my $dbh = DBI->connect($data_source, "gclarkii", "", \%attr)
or Error ("Could not connect to DB: $DBI::errstr");
return $dbh;
}
Am I doing something wrong??
I've got "Programming the Perl DBI", but I don't
see anything different.
Thanks for the help.
GB
--
GB Clark II | Roaming FreeBSD Admin
[EMAIL PROTECTED] | General Geek
CTHULU for President - Why choose the lesser of two evils?