Name

quote_identifier( )

Synopsis

$database_handle->quote_identifier($name)
$database_handle->quote_identifier($catalog, $schema, 
$database_handle->quote_identifier($catalog, $schema, 
                                   $table, \%attributes)

Use this to escape special characters of an identifier for use in an SQL statement. In the first syntax, the one parameter could be an identifier such as a table name. For the second syntax, the catalog name or link is given for the first parameter, a schema for the second, a table name for the third, and database attributes for the fourth. Here is an example of the first syntax:

my $sql_stmnt = "SHOW indexes FROM "
                . $dbh->quote_identifier($table);

Below is an example of the second syntax:

my $table_identifier = $dbh->quote_identifier('link', 'schema', 'table');

The value of $table_identifier would be "schema"."table"@"link".

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.