Свойство | Type | Description | |
---|---|---|---|
$db | the Sphinx connection. | ||
$querySeparator | separator between different SQL queries. This is mainly used by QueryBuilder::build when generating a SQL statement. | ||
$separator | the separator between different fragments of a SQL statement. Defaults to an empty space. This is mainly used by QueryBuilder::build when generating a SQL statement. |
Свойство | Type | Description | |
---|---|---|---|
$conditionBuilders | map of query condition to builder methods. These methods are used by [[buildCondition]] to build SQL conditions from array syntax. |
Méthode | Description | |
---|---|---|
__construct ( |
Constructor. | |
batchInsert ( string $index, array $columns, array $rows, array &$params ) : string | Generates a batch INSERT SQL statement. | |
batchReplace ( string $index, array $columns, array $rows, array &$params ) : string | Generates a batch REPLACE SQL statement. | |
build ( |
Generates a SELECT SQL statement from a Query object. | |
buildAndCondition ( |
Connects two or more SQL expressions with the AND or OR operator. | |
buildBetweenCondition ( |
Creates an SQL expressions with the BETWEEN operator. | |
buildColumns ( string | array $columns ) : string | Processes columns and properly quote them if necessary. | |
buildCondition ( |
Parses the condition specification and generates the corresponding SQL expression. | |
buildFrom ( array $indexes, array &$params ) : string | ||
buildGroupBy ( array $columns, integer $limit ) : string | ||
buildHashCondition ( |
Creates a condition based on column-value pairs. | |
buildHaving ( string[] $indexes, string | array $condition, array &$params ) : string | ||
buildInCondition ( |
Creates an SQL expressions with the IN operator. | |
buildLikeCondition ( |
Creates an SQL expressions with the LIKE operator. | |
buildLimit ( integer $limit, integer $offset ) : string | ||
buildMatch ( string | yii\db\Expression | |
||
buildNotCondition ( |
Inverts an SQL expressions with NOT operator. | |
buildOption ( array $options, array &$params ) : string | ||
buildOrderBy ( array $columns ) : string | ||
buildOrderByAndLimit ( string $sql, array $orderBy, integer $limit, integer $offset ) : string | Builds the ORDER BY and LIMIT/OFFSET clauses and appends them to the given SQL. | |
buildSelect ( array $columns, array &$params, boolean $distinct = false, string $selectOption = null ) : string | ||
buildSimpleCondition ( |
Creates an SQL expressions like "column" operator value. | |
buildWhere ( string[] $indexes, string | array $condition, array &$params, string | yii\db\Expression | null $match = null ) : string | ||
buildWithin ( array $columns ) : string | ||
callKeywords ( string $index, string $text, boolean $fetchStatistic, array &$params ) : string | Builds a SQL statement for returning tokenized and normalized forms of the keywords, and, optionally, keyword statistics. | |
callSnippets ( string $index, string | array $source, string $match, array $options, array &$params ) : string | Builds a SQL statement for call snippet from provided data and query, using specified index settings. | |
delete ( string $index, array | string $condition, array &$params ) : string | Creates a DELETE SQL statement. | |
getMatchBuilder ( ) : |
||
insert ( string $index, array $columns, array &$params ) : string | Creates an INSERT SQL statement. | |
replace ( string $index, array $columns, array &$params ) : string | Creates an REPLACE SQL statement. | |
truncateIndex ( string $index ) : string | Builds a SQL statement for truncating an index. | |
update ( string $index, array $columns, array | string $condition, array &$params, array $options ) : string | Creates an UPDATE SQL statement. |
Méthode | Description | |
---|---|---|
buildCompositeInCondition ( |
||
buildFacets ( array $facets, array &$params ) : string | ||
buildShowMeta ( boolean | string | yii\db\Expression $showMeta, array &$params ) : string | Builds SHOW META query. | |
composeColumnValue ( |
Composes column value for SQL, taking in account the column type. | |
generateBatchInsertReplace ( string $statement, string $index, array $columns, array $rows, array &$params ) : string | Generates a batch INSERT/REPLACE SQL statement. | |
generateInsertReplace ( string $statement, string $index, array $columns, array &$params ) : string | Generates INSERT/REPLACE SQL statement. |
Méthode | Description | |
---|---|---|
buildSelectFields ( array $columns, array &$params ) : string | ||
getIndexSchemas ( array $indexes ) : |
public __construct ( |
||
$connection | the Sphinx connection. | |
$config | array | name-value pairs that will be used to initialize the object properties |
public batchInsert ( string $index, array $columns, array $rows, array &$params ) : string | ||
$index | string | the index that new rows will be inserted into. |
$columns | array | the column names |
$rows | array | the rows to be batch inserted into the index |
$params | array | the binding parameters that will be generated by this method. They should be bound to the Sphinx command later. |
Résultat | string | the batch INSERT SQL statement |
public batchReplace ( string $index, array $columns, array $rows, array &$params ) : string | ||
$index | string | the index that new rows will be replaced. |
$columns | array | the column names |
$rows | array | the rows to be batch replaced in the index |
$params | array | the binding parameters that will be generated by this method. They should be bound to the Sphinx command later. |
Résultat | string | the batch INSERT SQL statement |
public build ( |
||
$query | the [[Query]] object from which the SQL statement will be generated | |
$params | array | the parameters to be bound to the generated SQL statement. These parameters will be included in the result with the additional parameters generated during the query building process. |
Résultat | array | the generated SQL statement (the first array element) and the corresponding parameters to be bound to the SQL statement (the second array element). The parameters returned include those provided in `$params`. |
public buildAndCondition ( |
||
$indexes | list of indexes, which affected by query | |
$operator | string | the operator to use for connecting the given operands |
$operands | array | the SQL expressions to connect. |
$params | array | the binding parameters to be populated |
Résultat | string | the generated SQL expression |
public buildBetweenCondition ( |
||
$indexes | list of indexes, which affected by query | |
$operator | string | the operator to use (e.g. `BETWEEN` or `NOT BETWEEN`) |
$operands | array | the first operand is the column name. The second and third operands describe the interval that column value should be in. |
$params | array | the binding parameters to be populated |
Résultat | string | the generated SQL expression |
protected buildCompositeInCondition ( |
||
$indexes | list of indexes, which affected by query | |
$operator | string | the operator to use (e.g. `IN` or `NOT IN`) |
$columns | array | |
$values | array | |
$params | array | the binding parameters to be populated |
Résultat | string | the generated SQL expression |
public buildCondition ( |
||
$indexes | list of indexes, which affected by query | |
$condition | string | array | the condition specification. Please refer to [[Query::where()]] on how to specify a condition. |
$params | array | the binding parameters to be populated |
Résultat | string | the generated SQL expression |
public buildHashCondition ( |
||
$indexes | list of indexes, which affected by query | |
$condition | array | the condition specification. |
$params | array | the binding parameters to be populated |
Résultat | string | the generated SQL expression |
public buildInCondition ( |
||
$indexes | list of indexes, which affected by query | |
$operator | string | the operator to use (e.g. `IN` or `NOT IN`) |
$operands | array | the first operand is the column name. If it is an array a composite IN condition will be generated. The second operand is an array of values that column value should be among. If it is an empty array the generated expression will be a `false` value if operator is `IN` and empty if operator is `NOT IN`. |
$params | array | the binding parameters to be populated |
Résultat | string | the generated SQL expression |
public buildLikeCondition ( |
||
$indexes | list of indexes, which affected by query | |
$operator | string | the operator to use (e.g. `LIKE`, `NOT LIKE`, `OR LIKE` or `OR NOT LIKE`) |
$operands | array | an array of two or three operands - The first operand is the column name. - The second operand is a single value or an array of values that column value should be compared with. If it is an empty array the generated expression will be a `false` value if operator is `LIKE` or `OR LIKE`, and empty if operator is `NOT LIKE` or `OR NOT LIKE`. - An optional third operand can also be provided to specify how to escape special characters in the value(s). The operand should be an array of mappings from the special characters to their escaped counterparts. If this operand is not provided, a default escape mapping will be used. You may use `false` or an empty array to indicate the values are already escaped and no escape should be applied. Note that when using an escape mapping (or the third operand is not provided), the values will be automatically enclosed within a pair of percentage characters. |
$params | array | the binding parameters to be populated |
Résultat | string | the generated SQL expression |
public buildNotCondition ( |
||
$indexes | list of indexes, which affected by query | |
$operator | string | the operator to use for connecting the given operands |
$operands | array | the SQL expressions to connect. |
$params | array | the binding parameters to be populated |
Résultat | string | the generated SQL expression |
public buildOrderBy ( array $columns ) : string | ||
$columns | array | |
Résultat | string | the ORDER BY clause built from [[query]]. |
public buildOrderByAndLimit ( string $sql, array $orderBy, integer $limit, integer $offset ) : string | ||
$sql | string | the existing SQL (without ORDER BY/LIMIT/OFFSET) |
$orderBy | array | the order by columns. See [[Query::orderBy]] for more details on how to specify this parameter. |
$limit | integer | the limit number. See [[Query::limit]] for more details. |
$offset | integer | the offset number. See [[Query::offset]] for more details. |
Résultat | string | the SQL completed with ORDER BY/LIMIT/OFFSET (if any) |
public buildSimpleCondition ( |
||
$indexes | list of indexes, which affected by query | |
$operator | string | the operator to use. Anything could be used e.g. `>`, `<=`, etc. |
$operands | array | contains two column names. |
$params | array | the binding parameters to be populated |
Résultat | string | the generated SQL expression |
public buildWhere ( string[] $indexes, string | array $condition, array &$params, string | yii\db\Expression | null $match = null ) : string | ||
$indexes | string[] | list of index names, which affected by query |
$condition | string | array | |
$params | array | the binding parameters to be populated |
$match | string | yii\db\Expression | null | |
Résultat | string | the WHERE clause built from [[query]]. |
public buildWithin ( array $columns ) : string | ||
$columns | array | |
Résultat | string | the ORDER BY clause built from [[query]]. |
public callKeywords ( string $index, string $text, boolean $fetchStatistic, array &$params ) : string | ||
$index | string | the name of the index from which to take the text processing settings |
$text | string | the text to break down to keywords. |
$fetchStatistic | boolean | whether to return document and hit occurrence statistics |
$params | array | the binding parameters that will be modified by this method so that they can be bound to the Sphinx command later. |
Résultat | string | the SQL statement for call keywords. |
public callSnippets ( string $index, string | array $source, string $match, array $options, array &$params ) : string | ||
$index | string | name of the index, from which to take the text processing settings. |
$source | string | array | is the source data to extract a snippet from. It could be either a single string or array of strings. |
$match | string | the full-text query to build snippets for. |
$options | array | list of options in format: optionName => optionValue |
$params | array | the binding parameters that will be modified by this method so that they can be bound to the Sphinx command later. |
Résultat | string | the SQL statement for call snippets. |
protected composeColumnValue ( |
||
$indexes | list of indexes, which affected by query | |
$columnName | string | name of the column |
$value | mixed | raw column value |
$params | array | the binding parameters to be populated |
Résultat | string | SQL expression, which represents column value |
public delete ( string $index, array | string $condition, array &$params ) : string | ||
$index | string | the index where the data will be deleted from. |
$condition | array | string | the condition that will be put in the WHERE part. Please refer to [[Query::where()]] on how to specify condition. |
$params | array | the binding parameters that will be modified by this method so that they can be bound to the Sphinx command later. |
Résultat | string | the DELETE SQL |
protected generateBatchInsertReplace ( string $statement, string $index, array $columns, array $rows, array &$params ) : string | ||
$statement | string | statement ot be generated. |
$index | string | the affected index name. |
$columns | array | the column data (name => value). |
$rows | array | the rows to be batch inserted into the index |
$params | array | the binding parameters that will be generated by this method. |
Résultat | string | generated SQL |
protected generateInsertReplace ( string $statement, string $index, array $columns, array &$params ) : string | ||
$statement | string | statement ot be generated. |
$index | string | the affected index name. |
$columns | array | the column data (name => value). |
$params | array | the binding parameters that will be generated by this method. |
Résultat | string | generated SQL |
public getMatchBuilder ( ) : |
||
Résultat | match builder. |
public insert ( string $index, array $columns, array &$params ) : string | ||
$index | string | the index that new rows will be inserted into. |
$columns | array | the column data (name => value) to be inserted into the index. |
$params | array | the binding parameters that will be generated by this method. They should be bound to the Sphinx command later. |
Résultat | string | the INSERT SQL |
public replace ( string $index, array $columns, array &$params ) : string | ||
$index | string | the index that new rows will be replaced. |
$columns | array | the column data (name => value) to be replaced in the index. |
$params | array | the binding parameters that will be generated by this method. They should be bound to the Sphinx command later. |
Résultat | string | the INSERT SQL |
public truncateIndex ( string $index ) : string | ||
$index | string | the index to be truncated. The name will be properly quoted by the method. |
Résultat | string | the SQL statement for truncating an index. |
public update ( string $index, array $columns, array | string $condition, array &$params, array $options ) : string | ||
$index | string | the index to be updated. |
$columns | array | the column data (name => value) to be updated. |
$condition | array | string | the condition that will be put in the WHERE part. Please refer to [[Query::where()]] on how to specify condition. |
$params | array | the binding parameters that will be modified by this method so that they can be bound to the Sphinx command later. |
$options | array | list of options in format: optionName => optionValue |
Résultat | string | the UPDATE SQL |
protected $conditionBuilders |
public $querySeparator |
public $separator |