Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^9: When every microsecond counts: Parsing subroutine parameters

by rhesa (Vicar)
on May 18, 2008 at 21:48 UTC ( #687258=note: print w/replies, xml ) Need Help??


in reply to Re^8: When every microsecond counts: Parsing subroutine parameters
in thread When every microsecond counts: Parsing subroutine parameters

There's one in DBI that annoys me on occasion, and that's do($statement, \%attr, @bind_values);. In my code, I haven't found any use of that method where I needed to pass attributes, but I do have a fair number where I use bind values. Example:
$dbh->do('update some_table set some_column=?', undef, $some_string);

Replies are listed 'Best First'.
Re^10: When every microsecond counts: Parsing subroutine parameters
by BrowserUk (Pope) on May 18, 2008 at 22:34 UTC

    Perfect example of a bad api (I'm assuming that your experience of rarely needing \%attr is widespread.)

    Maybe there is scope for the addition of a doBind() to the api that reverses the ordering of the last two parameters. Or just omits the second.

    But named parameters would be no advantage:

    $dbh->do( sql => 'update some_table set some_column=?', bind => [ $some_string ] );

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2020-09-28 22:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (144 votes). Check out past polls.

    Notices?