Detailed Description
Select statement.
Definition at line 25 of file SelectStatement.php.
 Inheritance diagram for SelectStatement:Public Member Functions | |
| __construct (RDBMapper $mapper, $id=self::NO_CACHE) | |
| __toString () | |
| getId () | |
| getType () | |
| isCached () | |
| setMeta ($key, $value) | |
| getMeta ($key) | |
| setParameters ($parameters) | |
| getParameters ($stripColons=false) | |
| getRowCount () | |
| save () | |
| join ($name, $on, $columns=self::SQL_STAR, $type=self::JOIN_INNER) | |
| addColumns (array $columns, $joinName=null) | |
| getAliasNames ($table) | |
| getSql () | |
| query () | |
| __sleep () | |
| __wakeup () | |
Static Public Member Functions | |
| static | get (RDBMapper $mapper, $id=self::NO_CACHE) | 
Public Attributes | |
| const | NO_CACHE = 'no_cache' | 
| const | CACHE_KEY = 'select' | 
Protected Member Functions | |
| getAdapter () | |
Static Protected Member Functions | |
| static | getCacheSection ($type) | 
| static | getCacheId ($id) | 
Protected Attributes | |
| $id = null | |
| $type = null | |
| $parameters = [] | |
| $parametersStripped = [] | |
| $meta = [] | |
| $cachedSql = [] | |
Constructor & Destructor Documentation
◆ __construct()
| __construct | ( | RDBMapper | $mapper, | 
$id = self::NO_CACHE  | 
        |||
| ) | 
Constructor.
- Parameters
 - 
  
$mapper RDBMapper instance $id The statement id (optional, default: SelectStatement::NO_CACHE)  
Definition at line 67 of file SelectStatement.php.
Member Function Documentation
◆ get()
      
  | 
  static | 
Get the SelectStatement instance with the given id.
If the id equals SelectStatement::NO_CACHE or is not cached, a new one will be created.
- Parameters
 - 
  
$mapper RDBMapper instance used to retrieve the database adapter $id The statement id (optional, default: SelectStatement::NO_CACHE)  
- Returns
 - SelectStatement
 
Definition at line 48 of file SelectStatement.php.
◆ __toString()
| __toString | ( | ) | 
◆ getId()
| getId | ( | ) | 
◆ getType()
| getType | ( | ) | 
Get the entity type associated with the statement.
- Returns
 - String
 
Definition at line 97 of file SelectStatement.php.
◆ isCached()
| isCached | ( | ) | 
Check if the statement is cached already.
- Returns
 - Boolean
 
Definition at line 105 of file SelectStatement.php.
◆ setMeta()
| setMeta | ( | $key, | |
| $value | |||
| ) | 
◆ getMeta()
| getMeta | ( | $key | ) | 
Get custom meta value.
- Parameters
 - 
  
$key  
- Returns
 - Associative array
 
Definition at line 125 of file SelectStatement.php.
◆ setParameters()
| setParameters | ( | $parameters | ) | 
Set the parameter values to replace the placeholders with when doing the select.
- Parameters
 - 
  
$parameters Associative array with placeholders as keys  
Definition at line 136 of file SelectStatement.php.
◆ getParameters()
| getParameters | ( | $stripColons = false | ) | 
Get the select parameters.
- Parameters
 - 
  
$stripColons Indicates whether to strip the colon character from the parameter name or not (default: false)  
- Returns
 - Array
 
Definition at line 149 of file SelectStatement.php.
◆ getRowCount()
| getRowCount | ( | ) | 
Execute a count query and return the row count.
- Returns
 - Integer
 
Definition at line 157 of file SelectStatement.php.
◆ save()
| save | ( | ) | 
Put the statement into the cache.
Definition at line 207 of file SelectStatement.php.
◆ join()
| join | ( | $name, | |
| $on, | |||
$columns = self::SQL_STAR,  | 
        |||
$type = self::JOIN_INNER  | 
        |||
| ) | 
- See also
 - Select::join()
 
Definition at line 217 of file SelectStatement.php.
◆ addColumns()
| addColumns | ( | array | $columns, | 
$joinName = null  | 
        |||
| ) | 
Add columns to the statement.
- Parameters
 - 
  
$columns Array of columns (  
- See also
 - Select::columns())
 
- Parameters
 - 
  
$joinName The name of the join to which the columns belong  
Definition at line 232 of file SelectStatement.php.
◆ getAliasNames()
| getAliasNames | ( | $table | ) | 
Get the alias names for a table name.
- Parameters
 - 
  
$tables  
- Returns
 - Array
 
Definition at line 258 of file SelectStatement.php.
◆ getSql()
| getSql | ( | ) | 
Get the sql string for this statement.
- Returns
 - String
 
Definition at line 276 of file SelectStatement.php.
◆ query()
| query | ( | ) | 
◆ getAdapter()
      
  | 
  protected | 
Get the adapter corresponding to the statement's type.
- Returns
 - AdapterInterface
 
Definition at line 310 of file SelectStatement.php.
◆ getCacheSection()
      
  | 
  staticprotected | 
Get the cache section.
- Parameters
 - 
  
$type The type  
- Returns
 - String
 
Definition at line 319 of file SelectStatement.php.
◆ getCacheId()
      
  | 
  staticprotected | 
Get the compressed cache id from the id.
- Parameters
 - 
  
$id  
- Returns
 - String
 
Definition at line 328 of file SelectStatement.php.
◆ __sleep()
| __sleep | ( | ) | 
Serialization handlers.
Definition at line 336 of file SelectStatement.php.
◆ __wakeup()
| __wakeup | ( | ) | 
Definition at line 340 of file SelectStatement.php.
Member Data Documentation
◆ NO_CACHE
| const NO_CACHE = 'no_cache' | 
Definition at line 27 of file SelectStatement.php.
◆ CACHE_KEY
| const CACHE_KEY = 'select' | 
Definition at line 28 of file SelectStatement.php.
◆ $id
      
  | 
  protected | 
Definition at line 30 of file SelectStatement.php.
◆ $type
      
  | 
  protected | 
Definition at line 31 of file SelectStatement.php.
◆ $parameters
      
  | 
  protected | 
Definition at line 32 of file SelectStatement.php.
◆ $parametersStripped
      
  | 
  protected | 
Definition at line 33 of file SelectStatement.php.
◆ $meta
      
  | 
  protected | 
Definition at line 34 of file SelectStatement.php.
◆ $cachedSql
      
  | 
  protected | 
Definition at line 35 of file SelectStatement.php.