Class lispa\amos\core\record\CachedQuery
Inheritance | lispa\amos\core\record\CachedQuery » yii\db\Query » yii\base\Component » yii\base\Object |
---|---|
Implements | yii\base\Configurable, yii\db\QueryInterface |
Uses Traits | yii\db\QueryTrait |
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$behaviors | yii\base\Behavior[] | List of behaviors attached to this component | yii\base\Component |
$distinct | boolean | Whether to select distinct rows of data only. | yii\db\Query |
$emulateExecution | boolean | Whether to emulate the actual query execution, returning empty or false results. | yii\db\QueryTrait |
$from | array | The table(s) to be selected from. | yii\db\Query |
$groupBy | array | How to group the query results. | yii\db\Query |
$having | string|array|yii\db\Expression | The condition to be applied in the GROUP BY clause. | yii\db\Query |
$indexBy | string|callable | The name of the column by which the query results should be indexed by. | yii\db\QueryTrait |
$join | array | How to join with other tables. | yii\db\Query |
$limit | integer|yii\db\Expression | Maximum number of records to be returned. | yii\db\QueryTrait |
$offset | integer|yii\db\Expression | Zero-based offset from where the records are to be returned. | yii\db\QueryTrait |
$orderBy | array | How to sort the query results. | yii\db\QueryTrait |
$params | array | List of query parameter values indexed by parameter placeholders. | yii\db\Query |
$queryCache | \lispa\amos\core\record\type | lispa\amos\core\record\CachedQuery | |
$select | array | The columns being selected. | yii\db\Query |
$selectOption | string | Additional option that should be appended to the 'SELECT' keyword. | yii\db\Query |
$union | array | This is used to construct the UNION clause(s) in a SQL statement. | yii\db\Query |
$where | string|array | Query condition. | yii\db\QueryTrait |
Public Methods
Method | Description | Defined By |
---|---|---|
__call() | Calls the named method which is not a class method. | yii\base\Component |
__clone() | This method is called after the object is created by cloning an existing one. | yii\base\Component |
__construct() | Constructor. | yii\base\Object |
__get() | Returns the value of a component property. | yii\base\Component |
__isset() | Checks if a property is set, i.e. defined and not null. | yii\base\Component |
__set() | Sets the value of a component property. | yii\base\Component |
__unset() | Sets a component property to be null. | yii\base\Component |
addGroupBy() | Adds additional group-by columns to the existing ones. | yii\db\Query |
addOrderBy() | Adds additional ORDER BY columns to the query. | yii\db\QueryTrait |
addParams() | Adds additional parameters to be bound to the query. | yii\db\Query |
addSelect() | Add more columns to the SELECT part of the query. | yii\db\Query |
all() | lispa\amos\core\record\CachedQuery | |
andFilterCompare() | Adds a filtering condition for a specific column and allow the user to choose a filter operator. | yii\db\Query |
andFilterHaving() | Adds an additional HAVING condition to the existing one but ignores empty operands. | yii\db\Query |
andFilterWhere() | Adds an additional WHERE condition to the existing one but ignores empty operands. | yii\db\QueryTrait |
andHaving() | Adds an additional HAVING condition to the existing one. | yii\db\Query |
andWhere() | Adds an additional WHERE condition to the existing one. | yii\db\QueryTrait |
attachBehavior() | Attaches a behavior to this component. | yii\base\Component |
attachBehaviors() | Attaches a list of behaviors to the component. | yii\base\Component |
average() | lispa\amos\core\record\CachedQuery | |
batch() | Starts a batch query. | yii\db\Query |
behaviors() | Returns a list of behaviors that this component should behave as. | yii\base\Component |
cache() | lispa\amos\core\record\CachedQuery | |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\base\Component |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\base\Component |
className() | Returns the fully qualified name of this class. | yii\base\Object |
clearCache() | Reset cache | lispa\amos\core\record\CachedQuery |
column() | lispa\amos\core\record\CachedQuery | |
count() | lispa\amos\core\record\CachedQuery | |
create() | Creates a new Query object and copies its property values from an existing one. | yii\db\Query |
createCommand() | Creates a DB command that can be used to execute this query. | yii\db\Query |
detachBehavior() | Detaches a behavior from the component. | yii\base\Component |
detachBehaviors() | Detaches all behaviors from the component. | yii\base\Component |
distinct() | Sets the value indicating whether to SELECT DISTINCT or not. | yii\db\Query |
each() | Starts a batch query and retrieves data row by row. | yii\db\Query |
emulateExecution() | Sets whether to emulate query execution, preventing any interaction with data storage. | yii\db\QueryTrait |
ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. | yii\base\Component |
exists() | lispa\amos\core\record\CachedQuery | |
filterHaving() | Sets the HAVING part of the query but ignores empty operands. | yii\db\Query |
filterWhere() | Sets the WHERE part of the query but ignores empty operands. | yii\db\QueryTrait |
from() | Sets the FROM part of the query. | yii\db\Query |
getBehavior() | Returns the named behavior object. | yii\base\Component |
getBehaviors() | Returns all behaviors attached to this component. | yii\base\Component |
getCacheComponent() | lispa\amos\core\record\CachedQuery | |
groupBy() | Sets the GROUP BY part of the query. | yii\db\Query |
hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. | yii\base\Component |
hasMethod() | Returns a value indicating whether a method is defined. | yii\base\Component |
hasProperty() | Returns a value indicating whether a property is defined for this component. | yii\base\Component |
having() | Sets the HAVING part of the query. | yii\db\Query |
indexBy() | Sets the indexBy() property. | yii\db\QueryTrait |
init() | Initializes the object. | yii\base\Object |
innerJoin() | Appends an INNER JOIN part to the query. | yii\db\Query |
instance() | Create a new instance of CachedQuery from $parentObj | lispa\amos\core\record\CachedQuery |
join() | Appends a JOIN part to the query. | yii\db\Query |
leftJoin() | Appends a LEFT OUTER JOIN part to the query. | yii\db\Query |
limit() | Sets the LIMIT part of the query. | yii\db\QueryTrait |
loadFromParentObj() | lispa\amos\core\record\CachedQuery | |
max() | lispa\amos\core\record\CachedQuery | |
min() | lispa\amos\core\record\CachedQuery | |
off() | Detaches an existing event handler from this component. | yii\base\Component |
offset() | Sets the OFFSET part of the query. | yii\db\QueryTrait |
on() | Attaches an event handler to an event. | yii\base\Component |
one() | lispa\amos\core\record\CachedQuery | |
orFilterHaving() | Adds an additional HAVING condition to the existing one but ignores empty operands. | yii\db\Query |
orFilterWhere() | Adds an additional WHERE condition to the existing one but ignores empty operands. | yii\db\QueryTrait |
orHaving() | Adds an additional HAVING condition to the existing one. | yii\db\Query |
orWhere() | Adds an additional WHERE condition to the existing one. | yii\db\QueryTrait |
orderBy() | Sets the ORDER BY part of the query. | yii\db\QueryTrait |
params() | Sets the parameters to be bound to the query. | yii\db\Query |
populate() | Converts the raw query results into the format as specified by this query. | yii\db\Query |
prepare() | Prepares for building SQL. | yii\db\Query |
reset() | Reset cache | lispa\amos\core\record\CachedQuery |
rightJoin() | Appends a RIGHT OUTER JOIN part to the query. | yii\db\Query |
scalar() | lispa\amos\core\record\CachedQuery | |
select() | Sets the SELECT part of the query. | yii\db\Query |
sum() | lispa\amos\core\record\CachedQuery | |
trigger() | Triggers an event. | yii\base\Component |
union() | Appends a SQL statement using UNION operator. | yii\db\Query |
where() | Sets the WHERE part of the query. | yii\db\QueryTrait |
Protected Methods
Method | Description | Defined By |
---|---|---|
filterCondition() | Removes empty operands from the given query condition. | yii\db\QueryTrait |
isEmpty() | Returns a value indicating whether the give value is "empty". | yii\db\QueryTrait |
normalizeOrderBy() | Normalizes format of ORDER BY data | yii\db\QueryTrait |
queryScalar() | Queries a scalar value by setting select() first. | yii\db\Query |
run() | lispa\amos\core\record\CachedQuery |
Property Details
Method Details
public array all ( $db = null ) | ||
$db | \lispa\amos\core\record\Connection | |
return | array | The query results. If the query results in nothing, an empty array will be returned. |
---|
public mixed average ( $q, $db = null ) | ||
$q | string | The column name or expression. |
$db | \lispa\amos\core\record\Connection | |
return | mixed | The average of the specified column values. |
---|
public void cache ( $duration = null, $queryCache = null ) | ||
$duration | ||
$queryCache |
Reset cache
public static void clearCache ( $queryCache ) | ||
$queryCache | string |
public array column ( $db = null ) | ||
$db | \lispa\amos\core\record\Connection | |
return | array | The first column of the query result. An empty array is returned if the query results in nothing. |
---|
public integer|string count ( $q = '*', $db = null ) | ||
$q | string | The COUNT expression. Defaults to '*'. |
$db | ||
return | integer|string | Number of records. |
---|
public boolean exists ( $db = null ) | ||
$db | \lispa\amos\core\record\Connection | |
return | boolean | Whether the query result contains any row of data. |
---|
public static null|\lispa\amos\core\record\yii\base\Component getCacheComponent ( $queryCache ) | ||
$queryCache | string |
Create a new instance of CachedQuery from $parentObj
public static void instance ( yii\db\Query $parentObj ) | ||
$parentObj | yii\db\Query |
public void loadFromParentObj ( yii\db\Query $parentObj ) | ||
$parentObj | yii\db\Query |
public mixed max ( $q, $db = null ) | ||
$q | string | The column name or expression. |
$db | \lispa\amos\core\record\Connection | |
return | mixed | The average of the specified column values. |
---|
public mixed min ( $q, $db = null ) | ||
$q | string | The column name or expression. |
$db | \lispa\amos\core\record\Connection | |
return | mixed | The maximum of the specified column values. |
---|
public array|boolean one ( $db = null ) | ||
$db | \lispa\amos\core\record\Connection | |
return | array|boolean | The first row (in terms of an array) of the query result. False is returned if the query results in nothing. |
---|
Reset cache
public static void reset ( $queryCache = null ) | ||
$queryCache | string |
protected mixed run ( $functionName, $q, $db = null ) | ||
$functionName | string | |
$q | string | The column name or expression. |
$db | \lispa\amos\core\record\Connection |
public \lispa\amos\core\record\tring|null|false scalar ( $db = null ) | ||
$db | \lispa\amos\core\record\Connection | |
return | \lispa\amos\core\record\tring|null|false | The value of the first column in the first row of the query result. False is returned if the query result is empty. |
---|
public mixed sum ( $q, $db = null ) | ||
$q | string | The column name or expression. |
$db | \lispa\amos\core\record\Connection | |
return | mixed | The sum of the specified column values. |
---|