develooper Front page | perl.dbi.users | Postings from April 2018

debugging and stepping into ->do

Thread Next
From:
Jeff Macdonald
Date:
April 25, 2018 15:13
Subject:
debugging and stepping into ->do
Message ID:
CAB8aueZY4Fuy8z6wVxZOGqmNwK41xOGd3iZi=RyYF0nv1=aSzw@mail.gmail.com
Hi,

When using DBD::mysql, I can step into the prepare and execute methods of
DBD, but I can't step into do (execution is the next code line after the do
statement). 'do' is defined in DBI.pm this way:

    sub do {
	my($dbh, $statement, $attr, @params) = @_;
	my $sth = $dbh->prepare($statement, $attr) or return undef;
	$sth->execute(@params) or return undef;
	my $rows = $sth->rows;
	($rows == 0) ? "0E0" : $rows;
    }


Based on this, if I were to put a breakpoint on execute, I should be able
to see 'do' statements via execute, but I don't. For example:

$dbh->do('insert into foo (a, b) values (1,2)')

should cause the execute method to be called, but that does not seem to be
the case. Is 'do' in DBI/DBD calling some magic method?
-- 
Jeff Macdonald
Ayer, MA

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About