Name

prepare_cached( )

Synopsis

$database_handle->prepare_cached($sql_standard[, \%attribute, $active])

This creates a statement handle like prepare( ), but stores the resulting statement handle in a hash. Attributes for a statement handle may be given in the second argument in the form of a hash. The third argument of the method changes the behavior of the handle if an active statement handle is already in the cache. Table 12-1 lists the four choices for this argument.

Table 12-1. Active argument for prepare_cached( )

Active value

Result

0

Warning messages will be issued, and finish( ) for the statement handle will be employed.

1

No warning will be displayed, but finish( ) will be executed.

2

Disables checking for an active handle.

3

Causes the new statement handle to replace the active one.

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.