0 follower

Interface Yiisoft\Db\Schema\QuoterInterface

Implemented byYiisoft\Db\Schema\Quoter

This interface provides a set of methods to quote table and column names, values, and other SQL expressions independently of the database.

Public Methods

Hide inherited methods

Method Description Defined By
cleanUpTableNames() Clean-up table names and aliases. Yiisoft\Db\Schema\QuoterInterface
ensureColumnName() Ensures name of the column is wrapped with [[ and ]]. Yiisoft\Db\Schema\QuoterInterface
ensureNameQuoted() Ensures name is wrapped with {{ and }}. Yiisoft\Db\Schema\QuoterInterface
getRawTableName() Returns the actual name of a given table name. Yiisoft\Db\Schema\QuoterInterface
getTableNameParts() Splits a full table name into parts in the appropriate order, using the part name as the key. Yiisoft\Db\Schema\QuoterInterface
quoteColumnName() Quotes a column name for use in a query. Yiisoft\Db\Schema\QuoterInterface
quoteSimpleColumnName() Quotes a simple column name for use in a query. Yiisoft\Db\Schema\QuoterInterface
quoteSimpleTableName() Quotes a simple table name for use in a query. Yiisoft\Db\Schema\QuoterInterface
quoteSql() Processes an SQL statement by quoting table and column names that are inside within double brackets. Yiisoft\Db\Schema\QuoterInterface
quoteTableName() Quotes a table name for use in a query. Yiisoft\Db\Schema\QuoterInterface
quoteValue() Quotes a string value for use in a query. Yiisoft\Db\Schema\QuoterInterface
unquoteSimpleColumnName() Unquotes a simple column name. Yiisoft\Db\Schema\QuoterInterface
unquoteSimpleTableName() Unquotes a simple table name. Yiisoft\Db\Schema\QuoterInterface

Method Details

Hide inherited methods

cleanUpTableNames() public abstract method

Clean-up table names and aliases.

Both aliases and names are enclosed into {{ and }}.

public abstract array cleanUpTableNames ( array $tableNames )
$tableNames array

Non-empty array.

throws InvalidArgumentException

                public function cleanUpTableNames(array $tableNames): array;

            
ensureColumnName() public abstract method

Ensures name of the column is wrapped with [[ and ]].

public abstract string ensureColumnName ( string $name )
$name string

The name to quote.

return string

The quoted name.

                public function ensureColumnName(string $name): string;

            
ensureNameQuoted() public abstract method

Ensures name is wrapped with {{ and }}.

public abstract string ensureNameQuoted ( string $name )
$name string

The name to quote.

return string

The quoted name.

                public function ensureNameQuoted(string $name): string;

            
getRawTableName() public abstract method

Returns the actual name of a given table name.

This method will strip off curly brackets from the given table name and replace the percentage character '%' with {@see \Yiisoft\Db\Schema\ConnectionInterface::tablePrefix}.

public abstract string getRawTableName ( string $name )
$name string

The table name to convert.

return string

The real name of the given table name.

                public function getRawTableName(string $name): string;

            
getTableNameParts() public abstract method

Splits a full table name into parts in the appropriate order, using the part name as the key.

For example, "dbname.tblname" will be split into an array ['schemaName' => 'dbname', 'name' => 'tblname']

public abstract string[] getTableNameParts ( string $name )
$name string

The full name of the table.

return string[]

The table name parts.

                public function getTableNameParts(string $name): array;

            
quoteColumnName() public abstract method

Quotes a column name for use in a query.

If the column name has a prefix, it quotes the prefix. If the column name is already quoted or has '(', '[[' or '{{', then this method does nothing.

See also quoteSimpleColumnName().

public abstract string quoteColumnName ( string $name )
$name string

The column name to quote.

return string

The quoted column name.

                public function quoteColumnName(string $name): string;

            
quoteSimpleColumnName() public abstract method

Quotes a simple column name for use in a query.

A simple column name should contain the column name only without any prefix. If the column name is already quoted or is the asterisk character '*', this method will do nothing.

public abstract string quoteSimpleColumnName ( string $name )
$name string

The column name to quote.

return string

The quoted column name.

                public function quoteSimpleColumnName(string $name): string;

            
quoteSimpleTableName() public abstract method

Quotes a simple table name for use in a query.

A simple table name should contain the table name only without any schema prefix. If the table name is already quoted, this method will do nothing.

public abstract string quoteSimpleTableName ( string $name )
$name string

The table name to quote.

return string

The quoted table name.

                public function quoteSimpleTableName(string $name): string;

            
quoteSql() public abstract method

Processes an SQL statement by quoting table and column names that are inside within double brackets.

Tokens inside within double curly brackets are treated as table names, while tokens inside within double square brackets are column names. They will be quoted as such.

Also, the percentage character "%" at the beginning or ending of a table name will be replaced with {@see \Yiisoft\Db\Connection\ConnectionInterface::setTablePrefix()}.

public abstract string quoteSql ( string $sql )
$sql string

The SQL statement to quote.

return string

The quoted SQL statement.

                public function quoteSql(string $sql): string;

            
quoteTableName() public abstract method

Quotes a table name for use in a query.

If the table name has a schema prefix, then it will also quote the prefix.

If the table name is already quoted or has ( or {{, then this method will do nothing.

See also quoteSimpleTableName().

public abstract string quoteTableName ( string $name )
$name string

The table name to quote.

return string

The quoted table name.

                public function quoteTableName(string $name): string;

            
quoteValue() public abstract method

Quotes a string value for use in a query.

Attention: The usage of this method isn't safe. Use prepared statements.

public abstract string quoteValue ( string $value )
$value string

The value to quote.

return string

The quoted value.

                public function quoteValue(string $value): string;

            
unquoteSimpleColumnName() public abstract method

Unquotes a simple column name.

A simple column name should contain the column name only without any prefix.

If the column name isn't quoted or is the asterisk character '*', this method will do nothing.

public abstract string unquoteSimpleColumnName ( string $name )
$name string

The column name to unquote.

return string

The unquoted column name.

                public function unquoteSimpleColumnName(string $name): string;

            
unquoteSimpleTableName() public abstract method

Unquotes a simple table name.

A simple table name should contain the table name only without any schema prefix.

If the table name isn't quoted, this method will do nothing.

public abstract string unquoteSimpleTableName ( string $name )
$name string

The table name to unquote.

return string

The unquoted table name.

                public function unquoteSimpleTableName(string $name): string;