PHP Класс yii\sphinx\Schema

С версии: 2.0
Автор: Paul Klimov ([email protected])
Наследование: extends yii\base\Object
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$db the Sphinx connection
$typeMap mapping from physical column types (keys) to abstract column types (values)

Открытые методы

Метод Описание
convertException ( Exception $e, string $rawSql ) : Exception Converts a DB exception to a more concrete one if possible.
createQueryBuilder ( ) : QueryBuilder Creates a query builder for the Sphinx.
getIndexNames ( boolean $refresh = false ) : string[] Returns all index names in the Sphinx.
getIndexSchema ( string $name, boolean $refresh = false ) : IndexSchema | null Obtains the metadata for the named index.
getIndexSchemas ( boolean $refresh = false ) : IndexSchema[] Returns the metadata for all indexes in the database.
getIndexTypes ( boolean $refresh = false ) : array Returns all index types in the Sphinx.
getPdoType ( mixed $data ) : integer Determines the PDO type for the given PHP data value.
getQueryBuilder ( ) : QueryBuilder
getRawIndexName ( string $name ) : string Returns the actual name of a given index name.
isReadQuery ( string $sql ) : boolean Returns a value indicating whether a SQL statement is for read purpose.
quoteColumnName ( string $name ) : string Quotes a column name for use in a query.
quoteIndexName ( string $name ) : string Quotes a index name for use in a query.
quoteSimpleColumnName ( string $name ) : string Quotes a column name for use in a query.
quoteSimpleIndexName ( string $name ) : string Quotes a index name for use in a query.
quoteValue ( string $str ) : string Quotes a string value for use in a query.
refresh ( ) Refreshes the schema.

Защищенные методы

Метод Описание
applyDefaultColumns ( IndexSchema $index ) Sets up the default columns for given index.
findColumns ( IndexSchema $index ) : boolean Collects the metadata of index columns.
findIndexes ( ) : array Returns all index names in the Sphinx.
getCacheKey ( string $name ) : mixed Returns the cache key for the specified index name.
getCacheTag ( ) : string Returns the cache tag name.
getColumnPhpType ( ColumnSchema $column ) : string Extracts the PHP type from abstract DB type.
initIndexesInfo ( ) Initializes information about name and type of all index in the Sphinx.
loadColumnSchema ( array $info ) : ColumnSchema Loads the column information into a ColumnSchema object.
loadIndexSchema ( string $name ) : IndexSchema | null Loads the metadata for the specified index.
resolveIndexNames ( IndexSchema $index, string $name ) Resolves the index name.
resolveIndexType ( IndexSchema $index ) Resolves the index name.

Описание методов

applyDefaultColumns() защищенный Метод

This method should be used in case there is no way to find actual columns, like in some distributed indexes.
С версии: 2.0.6
protected applyDefaultColumns ( IndexSchema $index )
$index IndexSchema the index metadata

convertException() публичный Метод

Converts a DB exception to a more concrete one if possible.
public convertException ( Exception $e, string $rawSql ) : Exception
$e Exception
$rawSql string SQL that produced exception
Результат yii\db\Exception

createQueryBuilder() публичный Метод

Creates a query builder for the Sphinx.
public createQueryBuilder ( ) : QueryBuilder
Результат QueryBuilder query builder instance

findColumns() защищенный Метод

Collects the metadata of index columns.
protected findColumns ( IndexSchema $index ) : boolean
$index IndexSchema the index metadata
Результат boolean whether the index exists in the database

findIndexes() защищенный Метод

Returns all index names in the Sphinx.
protected findIndexes ( ) : array
Результат array all index names in the Sphinx.

getCacheKey() защищенный Метод

Returns the cache key for the specified index name.
protected getCacheKey ( string $name ) : mixed
$name string the index name
Результат mixed the cache key

getCacheTag() защищенный Метод

This allows Schema::refresh to invalidate all cached index schemas.
protected getCacheTag ( ) : string
Результат string the cache tag name

getColumnPhpType() защищенный Метод

Extracts the PHP type from abstract DB type.
protected getColumnPhpType ( ColumnSchema $column ) : string
$column ColumnSchema the column schema information
Результат string PHP type name

getIndexNames() публичный Метод

Returns all index names in the Sphinx.
public getIndexNames ( boolean $refresh = false ) : string[]
$refresh boolean whether to fetch the latest available index names. If this is false, index names fetched previously (if available) will be returned.
Результат string[] all index names in the Sphinx.

getIndexSchema() публичный Метод

Obtains the metadata for the named index.
public getIndexSchema ( string $name, boolean $refresh = false ) : IndexSchema | null
$name string index name. The index name may contain schema name if any. Do not quote the index name.
$refresh boolean whether to reload the index schema even if it is found in the cache.
Результат IndexSchema | null index metadata. `null` - if the named index does not exist.

getIndexSchemas() публичный Метод

Returns the metadata for all indexes in the database.
public getIndexSchemas ( boolean $refresh = false ) : IndexSchema[]
$refresh boolean whether to fetch the latest available index schemas. If this is false, cached data may be returned if available.
Результат IndexSchema[] the metadata for all indexes in the Sphinx. Each array element is an instance of [[IndexSchema]] or its child class.

getIndexTypes() публичный Метод

Returns all index types in the Sphinx.
public getIndexTypes ( boolean $refresh = false ) : array
$refresh boolean whether to fetch the latest available index types. If this is false, index types fetched previously (if available) will be returned.
Результат array all index types in the Sphinx in format: index name => index type.

getPdoType() публичный Метод

Determines the PDO type for the given PHP data value.
См. также: http://www.php.net/manual/en/pdo.constants.php
public getPdoType ( mixed $data ) : integer
$data mixed the data whose PDO type is to be determined
Результат integer the PDO type

getQueryBuilder() публичный Метод

public getQueryBuilder ( ) : QueryBuilder
Результат QueryBuilder the query builder for this connection.

getRawIndexName() публичный Метод

This method will strip off curly brackets from the given index name and replace the percentage character '%' with [[Connection::indexPrefix]].
public getRawIndexName ( string $name ) : string
$name string the index name to be converted
Результат string the real name of the given index name

initIndexesInfo() защищенный Метод

Initializes information about name and type of all index in the Sphinx.
protected initIndexesInfo ( )

isReadQuery() публичный Метод

Returns a value indicating whether a SQL statement is for read purpose.
public isReadQuery ( string $sql ) : boolean
$sql string the SQL statement
Результат boolean whether a SQL statement is for read purpose.

loadColumnSchema() защищенный Метод

Loads the column information into a ColumnSchema object.
protected loadColumnSchema ( array $info ) : ColumnSchema
$info array column information
Результат ColumnSchema the column schema object

loadIndexSchema() защищенный Метод

Loads the metadata for the specified index.
protected loadIndexSchema ( string $name ) : IndexSchema | null
$name string index name
Результат IndexSchema | null driver dependent index metadata. `null` - if the index does not exist.

quoteColumnName() публичный Метод

If the column name contains prefix, the prefix will also be properly quoted. If the column name is already quoted or contains '(', '[[' or '{{', then this method will do nothing.
См. также: quoteSimpleColumnName
public quoteColumnName ( string $name ) : string
$name string column name
Результат string the properly quoted column name

quoteIndexName() публичный Метод

If the index name contains schema prefix, the prefix will also be properly quoted. If the index name is already quoted or contains '(' or '{{', then this method will do nothing.
См. также: quoteSimpleTableName
public quoteIndexName ( string $name ) : string
$name string index name
Результат string the properly quoted index name

quoteSimpleColumnName() публичный Метод

A simple column name has no prefix.
public quoteSimpleColumnName ( string $name ) : string
$name string column name
Результат string the properly quoted column name

quoteSimpleIndexName() публичный Метод

A simple index name has no schema prefix.
public quoteSimpleIndexName ( string $name ) : string
$name string index name
Результат string the properly quoted index name

quoteValue() публичный Метод

Note that if the parameter is not a string, it will be returned without change.
См. также: http://www.php.net/manual/en/function.PDO-quote.php
public quoteValue ( string $str ) : string
$str string string to be quoted
Результат string the properly quoted string

refresh() публичный Метод

This method cleans up all cached index schemas so that they can be re-created later to reflect the Sphinx schema change.
public refresh ( )

resolveIndexNames() защищенный Метод

Resolves the index name.
protected resolveIndexNames ( IndexSchema $index, string $name )
$index IndexSchema the index metadata object
$name string the index name

resolveIndexType() защищенный Метод

Resolves the index name.
protected resolveIndexType ( IndexSchema $index )
$index IndexSchema the index metadata object

Описание свойств

$db публичное свойство

the Sphinx connection
public $db

$typeMap публичное свойство

mapping from physical column types (keys) to abstract column types (values)
public $typeMap