pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
DBD::Pg or DBI breakage?
3+ messages / 3 participants
[nested] [flat]

* DBD::Pg or DBI breakage?
@ 2001-05-23 20:34 Zachary Beane <xach@xach.com>
  2001-05-24 15:32 ` Re: DBD::Pg or DBI breakage? Jeremy Buchmann <jeremy@wellsgaming.com>
  2001-05-24 16:54 ` Re: DBD::Pg or DBI breakage? Oleg Bartunov <oleg@sai.msu.su>
  0 siblings, 2 replies; 3+ messages in thread

From: Zachary Beane @ 2001-05-23 20:34 UTC (permalink / raw)
  To: pgsql-interfaces

I've been having trouble getting the proper value of $handle->errstr
or $DBI::errstr. For some reason, it's always giving the scalar 7 back
rather than an informative error message. Here's an script and output:

--- foo.pl ---
#!/usr/bin/perl

use DBI;
my $dbh = DBI->connect("dbi:Pg:dbname=template1", "xach", undef);

my $sql = "bogus sql goes here";
my $sth = $dbh->prepare($sql);
$sth->execute() or die $sth->errstr;

my ($result) = $sth->fetchrow_array();

$sth->finish;

print $result, "\n";
$dbh->disconnect();
--- end ---

When run, it prints out this:

   $ perl foo.pl 
   DBD::Pg::st execute failed:  at foo.pl line 8.
   7 at foo.pl line 8.
   Database handle destroyed without explicit disconnect.

Now, I'm not surprised at the "database handle destroyed..." part, but
I can't figure out why i'm getting "7 at foo.pl" and a blank message
in the execute failed string. Any ideas?

Zach
-- 
xach@xach.com     Zachary Beane     http://www.xach.com/



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: DBD::Pg or DBI breakage?
  2001-05-23 20:34 DBD::Pg or DBI breakage? Zachary Beane <xach@xach.com>
@ 2001-05-24 15:32 ` Jeremy Buchmann <jeremy@wellsgaming.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Jeremy Buchmann @ 2001-05-24 15:32 UTC (permalink / raw)
  To: Zachary Beane <xach@xach.com>; pgsql-interfaces

> I've been having trouble getting the proper value of $handle->errstr
> or $DBI::errstr. For some reason, it's always giving the scalar 7 back
> rather than an informative error message. Here's an script and output:
> 
> --- foo.pl ---
> #!/usr/bin/perl
> 
> use DBI;
> my $dbh = DBI->connect("dbi:Pg:dbname=template1", "xach", undef);
> 
> my $sql = "bogus sql goes here";
> my $sth = $dbh->prepare($sql);
> $sth->execute() or die $sth->errstr;
> 
> my ($result) = $sth->fetchrow_array();
> 
> $sth->finish;
> 
> print $result, "\n";
> $dbh->disconnect();
> --- end ---
> 
> When run, it prints out this:
> 
> $ perl foo.pl 
> DBD::Pg::st execute failed:  at foo.pl line 8.
> 7 at foo.pl line 8.
> Database handle destroyed without explicit disconnect.
> 
> Now, I'm not surprised at the "database handle destroyed..." part, but
> I can't figure out why i'm getting "7 at foo.pl" and a blank message
> in the execute failed string. Any ideas?

Try disabling automatic error checking...after the call to DBI->connect, do
this:

$dbh->{PrintError} = 0;

-- Jeremy  [jeremy@wellsgaming.com]




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: DBD::Pg or DBI breakage?
  2001-05-23 20:34 DBD::Pg or DBI breakage? Zachary Beane <xach@xach.com>
@ 2001-05-24 16:54 ` Oleg Bartunov <oleg@sai.msu.su>
  1 sibling, 0 replies; 3+ messages in thread

From: Oleg Bartunov @ 2001-05-24 16:54 UTC (permalink / raw)
  To: Zachary Beane <xach@xach.com>; +Cc: pgsql-interfaces

Zach,

We just found a bug in DBD-PG 0.98 and sent bug report to Edmund.
You may try our patch:

	Regards,

		Oleg



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2001-05-24 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-23 20:34 DBD::Pg or DBI breakage? Zachary Beane <xach@xach.com>
2001-05-24 15:32 ` Jeremy Buchmann <jeremy@wellsgaming.com>
2001-05-24 16:54 ` Oleg Bartunov <oleg@sai.msu.su>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox