mysql_qualify

NAME

mysql_qualify(): Return a qualified MySQL object name.

TYPE

Function

DESCRIPTION

A qualified MySQL object name is its name surrounded by backticks, e.g. `sakila`. The function wraps the given text with backticks, if it is not already qualified as such. It handles cases where a backtick is part of the object's name (though this is considered poor practice).

SYNOPSIS

mysql_qualify(name TINYTEXT CHARSET utf8) 
  RETURNS TINYTEXT CHARSET utf8

Input:

  • name: an object's name. An object is a schema, table, column, index, foreign key, view, trigger, etc.

EXAMPLES

Qualify a simple name:

mysql> SELECT common_schema.mysql_qualify('film_actor') AS qualified;
+--------------+
| qualified    |
+--------------+
| `film_actor` |
+--------------+

ENVIRONMENT

MySQL 5.1 or newer

AUTHOR

Shlomi Noach
 
common_schema documentation