Name
bind_col
Synopsis
$rc = $sth->bind_col($column_number, \$var_to_bind);
Binds an
output
column (field) of a SELECT
statement to a Perl
variable. See bind_columns
for an example. Note
that column numbers count up from 1.
Whenever a row is fetched from the database, the corresponding Perl variable is automatically updated. There is no need to fetch and assign the values manually. The binding is performed at a very low level using Perl aliasing, so there is no extra copying taking place. This makes using bound variables very efficient.
For maximum portability between drivers, bind_col
should be called after execute
. This restriction
may be removed in a later version of the DBI.
You do not need to bind output columns in order to fetch data, but it
can be useful for some applications that need either maximum
performance or greater clarity of code. The bind_ param
method performs a similar but opposite function for
input variables.
Get Programming the Perl DBI now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.