perldb_and_dbi

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Subject: A truly stupid question
From: Steve Gorman <gormanst@returnpath.net>
Date: Tue, 12 Sep 2000 10:02:46 -0400

I am doing some error checking in my perldb code. Is this true?

  When I issue an execute command
        example: $RESULT = $sth->execute()or warn "$DBI::errstr\n";

If it is successful then $RESULT will equal (-1)?

I know I read this in the PerlDBI book but, for the life of me, I can't
find were I read it.

===

Subject: Re: A truly stupid question
From: Ronald J Kimball <rjk-dbi@focalex.com>
Date: Tue, 12 Sep 2000 10:14:02 -0400

On Tue, Sep 12, 2000 at 10:02:46AM -0400, Steve Gorman wrote:
> 
> I am doing some error checking in my perldb code. Is this true?
> 
>   When I issue an execute command
>         example: $RESULT = $sth->execute()or warn "$DBI::errstr\n";
> 
> If it is successful then $RESULT will equal (-1)?

If $RESULT == -1, then the execute was successful; the converse isn't
always true however.


> I know I read this in the PerlDBI book but, for the life of me, I can't
> find were I read it.

perldoc DBI:

       execute

             $rv = $sth->execute                || die $sth->errstr;
             $rv = $sth->execute(@bind_values)  || die $sth->errstr;

           Perform whatever processing is necessary to execute
           the prepared statement.  An undef is returned if an
           error occurs.  A successful execute always returns
           true regardless of the number of rows affected, even
           if it's zero (see below). It is always important to
           check the return status of execute (and most other DBI
           methods) for errors.

           For a non-SELECT statement, execute returns the number
           of rows affected, if known. If no rows were affected,
           then execute returns "0E0", which Perl will treat as 0
           but will regard as true. Note that it is not an error
           for no rows to be affected by a statement. If the
           number of rows affected is not known, then execute
           returns -1.

===

the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu