Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: How to mock results to repeated $sth->execute() calls (DBD::Mock::Session)

by tirwhan (Abbot)
on Dec 11, 2005 at 16:27 UTC ( [id://515854]=note: print w/replies, xml ) Need Help??


in reply to Re: How to mock results to repeated $sth->execute() calls (DBD::Mock::Session)
in thread How to mock results to repeated $sth->execute() calls (DBD::Mock::Session)

Thanks a lot ChemBoy, that put me on the right track. I still had to modify execute() to put the correct result set into the statement tracker, but now it seems to work fine.

Here's the change I made, for posterity (it's a godawful hack, but maybe it'll still be useful to someone at some point):

@@ -559,6 +559,10 @@ my $dbh = $sth->{Database}; eval { $session->verify_bound_params($dbh, $tracker->bound_param +s()); + my $idx=$session->{state_index}-1; + my @results=@{$session->{states}[$idx]{results}}; + shift @results; + $tracker->{return_data}=\@results; }; if ($@) { my $session_error = $@;

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://515854]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-19 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found