http://qs321.pair.com?node_id=687258


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 (Patriarch) 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.