Attributes for Handles

This section lists the values that can be added to the optional %attributes hash that appears in many Perl DBI methods. The basic syntax to set an attribute is $handle->{attribute} = 'setting'; to retrieve a setting use $handle->{attribute}.

Attributes for All Handles

You can use the following attributes with both database handles and statement handles.

Active

Instructs the server that the handle should remain open until terminated explicitly by finish() or disconnect( ) depending on the handle type.

ActiveKids

Provides the number of active handles under the handle that employed the attribute. If it’s set by a database handle, then the number of active statement handles will be returned. If it’s called by a database handle, the number of active statement handles will be returned. If set by a driver handle, the number of database handles will be returned.

CacheKids

Returns a reference to a hash containing child handles for a driver or a database handle that was created by the connect_cached( ) or prepare_cached( ) methods, respectively.

ChopBlanks

Trims trailing spaces from fixed-width character columns.

CompatMode

Makes emulation layers compatible with a driver handle.

ErrCount

Counts the number of errors logged by set_err( ).

Executed

Determines whether a handle or one of its children has been executed.

FetchHashKeyName

Instructs fetchrow_hashref() calls to convert column names to either all lowercase (NAME_lc) or all uppercase (NAME_uc) letters.

HandleError ...

Get MySQL in a Nutshell 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.