[Zope-Perl] Beta 1
Gisle Aas
gisle@ActiveState.com
02 Oct 2000 14:07:08 -0700
Joseph Wayne Norton <norton@alum.mit.edu> writes:
> I believe I fixed a bug with the Zope.pm module for zope dbi. If the
> query is not a select statement, then $sth->{NUM_OF_FIELDS} should be
> equal to 0.
>
> Please review.
>
> regards,
>
> - joe n.
>
> *** Zope.pm.orig Tue Sep 19 05:24:27 2000
> --- Zope.pm Mon Sep 25 17:21:06 2000
> ***************
> *** 269,275 ****
> my $sth = $dbh->prepare($q);
> my $rows = $sth->execute;
>
> ! if (my $name = $sth->{NAME}) {
> # it was a select statement
> if ($heading) {
> Python::raise 'Query Error', 'Multiple select statements'
> --- 269,275 ----
> my $sth = $dbh->prepare($q);
> my $rows = $sth->execute;
>
> ! if ($sth->{NUM_OF_FIELDS} and my $name = $sth->{NAME}) {
> # it was a select statement
> if ($heading) {
> Python::raise 'Query Error', 'Multiple select statements'
Looks correct. I only tested this with MySQL and its DBD seems to
allow $sth->{NAME} as a reliable test. The DBI documentation seems to
suggest that $sth->{NUM_OF_FIELDS} is a better check. Next release
will do something very similar to this.
Thanks!
--Gisle