in reply to Re: Return values from $dbh->do vs. $sth->execute();
in thread Return values from $dbh->do vs. $sth->execute();

Thank you for the quick response
I am afraid though, that you misread my question.
The issue I am having is not between "0E0" vs "0" being returned (that was a side note to indicate that I have already accounted for that), my issue is that the number of rows affected by the query is not being consistently returned. With $dbh->do I get a consistent return value but I cannot prepare with ?'s. If I prepare the statement and assign it to a statement handle my $sth = $dbh->prepare($query) || die $dbh->errstr; I cannot count on getting the number of rows affected. Is this consistent with DBI? or does this behavior seem specific to my system setup? Is there a property of the $dbh I should be checking?

You also mentioned utilizing placeholders ? within a $dbh->do() call, where could I find information regarding that, or would you be so kind as to offer an example?

Like I hopefully mentioned earlier this is not a critical issue for me but I figured I should post it as a question in case there was someone else who has seen this behavior and had already found the explaination/solution. Thank you again
-injunjoel

Replies are listed 'Best First'.
Re: Re: Answer: Return values from $dbh->do vs. $sth->execute();
by mpeppler (Vicar) on Nov 24, 2003 at 23:58 UTC
    For placeholders with do():
    # Execute a delete from table foo where bar = "bars_value": $dbh->do("delete from foo where bar = ?", undef, "bars_value");
    For the return codes, the DBI spec says that do() and execute() should return the same thing - that is the number of rows affected by the operation, if that information is available, or -1 if the number of rows affected is unknown.

    Now I don't know much about MySQL, or about DBD::mysql, so there may be something special going on here. You might want to check the DBD::mysql documentation directly.

    Michael