PHP Класс Habari\Query

См. также: Posts::get
Показать файл Открыть проект

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

Свойство Тип Описание
$primary_table

Защищенные свойства (Protected)

Свойство Тип Описание
$fields
$groupby
$having
$join_params
$joins
$limit
$offset
$orderby

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

Метод Описание
__construct ( $primary_table = null ) Construct a Query
column ( ) : array Execute and return the first first field from each row of this query
create ( string $primary_table = null ) : Query Static helper method to create a new query instance
distinct ( boolean $set = true ) : Query Set whether only distinct results should be returned
from ( string $primary_table ) : Query Sets the primary table for the FROM statement
get ( ) : string Obtain the SQL used to execute this query
groupby ( string $value ) : Query Set the GROUP BY clause
having ( $value )
join ( string $join, array $parameters = [], string $alias = null ) : Query Adds a JOIN table
joined ( string $alias ) : boolean Discover if a table alias is already JOINed to this query
keyvalue ( ) : array Execute and return key-value pairs from this query
limit ( integer $value ) : Query Sets the LIMIT
new_param_name ( string $prefix = 'param' ) : string Obtain a parameter name with an optionally specified prefix that has not yet been used
offset ( integer $value ) : Query Sets the OFFSET
orderby ( string $value ) : Query Set the ORDER BY clause
params ( ) : array Obtain the parameter values needed for the query
results ( string $class = null ) : array Execute and return the returns of this query
row ( string $class = null ) : object Execute and return the first row of this query
select ( array | string $fields ) : Query Adds fields to the SELECT statement
set_select ( array | string $fields ) : Query Sets fields for the SELECT statement
value ( ) : object Execute and return the first row of this query
where ( string $operator = 'AND' ) : QueryWhere Create and/or return a QueryWhere object representing the where clause of this query

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

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

Construct a Query
public __construct ( $primary_table = null )
$primary_table Name of the primary table (use {table} syntax to expand)

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

Execute and return the first first field from each row of this query
public column ( ) : array
Результат array The result array of values

create() публичный статический Метод

Static helper method to create a new query instance
public static create ( string $primary_table = null ) : Query
$primary_table string Name of the primary table (use {table} syntax to expand)
Результат Query A new instance of the Query class

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

Set whether only distinct results should be returned
public distinct ( boolean $set = true ) : Query
$set boolean True if the result set should be distinct
Результат Query Returns $this for fluid interface

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

Sets the primary table for the FROM statement
public from ( string $primary_table ) : Query
$primary_table string The primary table from which to select
Результат Query Returns $this for fluid interface

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

Obtain the SQL used to execute this query
public get ( ) : string
Результат string The SQL to execute

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

Set the GROUP BY clause
public groupby ( string $value ) : Query
$value string The GROUP BY clause
Результат Query Returns $this for fluid interface

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

public having ( $value )

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

Adds a JOIN table
public join ( string $join, array $parameters = [], string $alias = null ) : Query
$join string The table to create a join with
$parameters array An array of parameters on which the JOIN is built
$alias string An optional alias for the joined table
Результат Query Returns $this for fluid interface

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

Discover if a table alias is already JOINed to this query
public joined ( string $alias ) : boolean
$alias string The name of a JOIN table alias
Результат boolean true if the alias was used for a join

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

Execute and return key-value pairs from this query
public keyvalue ( ) : array
Результат array The results array of QueryRecords or the specified class

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

Sets the LIMIT
public limit ( integer $value ) : Query
$value integer The LIMIT
Результат Query Returns $this for fluid interface

new_param_name() публичный статический Метод

Obtain a parameter name with an optionally specified prefix that has not yet been used
public static new_param_name ( string $prefix = 'param' ) : string
$prefix string An optional prefix to use for a new parameter
Результат string the new parameter

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

Sets the OFFSET
public offset ( integer $value ) : Query
$value integer The OFFSET
Результат Query Returns $this for fluid interface

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

Set the ORDER BY clause
public orderby ( string $value ) : Query
$value string The ORDER BY clause
Результат Query Returns $this for fluid interface

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

Obtain the parameter values needed for the query
public params ( ) : array
Результат array An associative array containing the parameters of the query

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

Execute and return the returns of this query
public results ( string $class = null ) : array
$class string The optional class to return results as
Результат array The results array of QueryRecords or the specified class

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

Execute and return the first row of this query
public row ( string $class = null ) : object
$class string The optional class to return results as
Результат object The result object, a QueryRecord or the specified class

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

Adds fields to the SELECT statement
public select ( array | string $fields ) : Query
$fields array | string A field or list of fields to add to existing select'ed fields
Результат Query Returns $this for fluid interface

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

Sets fields for the SELECT statement
public set_select ( array | string $fields ) : Query
$fields array | string A field or list of fields to set as the fields to select, replaces existing selected fields
Результат Query Returns $this for fluid interface

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

Execute and return the first row of this query
public value ( ) : object
Результат object The result object, a QueryRecord or the specified class

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

Create and/or return a QueryWhere object representing the where clause of this query
public where ( string $operator = 'AND' ) : QueryWhere
$operator string The operator (AND/OR) to use between expressions in this clause
Результат QueryWhere An instance of the where clause for this query

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

$fields защищенное свойство

protected $fields

$groupby защищенное свойство

protected $groupby

$having защищенное свойство

protected $having

$join_params защищенное свойство

protected $join_params

$joins защищенное свойство

protected $joins

$limit защищенное свойство

protected $limit

$offset защищенное свойство

protected $offset

$orderby защищенное свойство

protected $orderby

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

public $primary_table