prepare/execute/fetch(Perl DBI

1) the first “catch-phrase” to memorize is the most common

– – – > prepare/execute/fetch

All 3 methods are specified in DBI but implemented (vendor-specific) in DBD modules ie DBD drivers.

2) For non-select, prepare/execute will do.
3) The simplest: do() alone can replace prepare/execute.
4) prepare/bind/bind/bind/bind/bind/bind/bind/../execute/fetch
5) stored procedure with 3 result sets ie 3 selects[1]: prepare/execute /fetch/more_results/fetch/more_results/fetch

Beware that most of these methods belong to $statement_handle like

– – – – > $statement_handle -> method1

whereas a few belong to $db_handle.

[1] excluding select-into. I think a select-into always returns one(???) row and saves it into variables and does not produce a result set.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s