PHP 클래스 Bluz\Db\Query\Select

상속: extends AbstractBuilder, use trait Bluz\Db\Query\Traits\From, use trait Bluz\Db\Query\Traits\Where, use trait Bluz\Db\Query\Traits\Order, use trait Bluz\Db\Query\Traits\Limit
파일 보기 프로젝트 열기: bluzphp/framework 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$fetchType PDO fetch types or object class

공개 메소드들

메소드 설명
addGroupBy ( variadic $groupBy ) : Select Adds a grouping expression to the query.
addSelect ( string $select ) : Select Adds an item that is to be returned in the query result.
andHaving ( variadic $condition ) : Select Adds a restriction over the groups of the query, forming a logical conjunction with any existing having restrictions
execute ( integer | string | object $fetchType = null ) : integer | string | array
getSql ( ) : string
groupBy ( variadic $groupBy ) : Select Specifies a grouping over the results of the query.
having ( variadic $condition ) : Select Specifies a restriction over the groups of the query.
innerJoin ( string $fromAlias, string $join, string $alias, string $condition = null ) : Select Creates and adds a join to the query
join ( string $fromAlias, string $join, string $alias, string $condition = null ) : Select Creates and adds a join to the query
leftJoin ( string $fromAlias, string $join, string $alias, string $condition = null ) : Select Creates and adds a left join to the query.
orHaving ( variadic $condition ) : Select Adds a restriction over the groups of the query, forming a logical disjunction with any existing having restrictions
rightJoin ( string $fromAlias, string $join, string $alias, string $condition = null ) : Select Creates and adds a right join to the query.
select ( variadic $select ) : Select Specifies an item that is to be returned in the query result Replaces any previously specified selections, if any
setFetchType ( string $fetchType ) : Select Setup fetch type, any of PDO, or any Class
setPage ( integer $page = 1 ) : Select Setup offset like a page number, start from 1

보호된 메소드들

메소드 설명
getSQLForJoins ( string $fromAlias ) : string Generate SQL string for JOINs

메소드 상세

addGroupBy() 공개 메소드

Example $sb = new Select(); $sb ->select('u.name') ->from('users', 'u') ->groupBy('u.lastLogin'); ->addGroupBy('u.createdAt')
public addGroupBy ( variadic $groupBy ) : Select
$groupBy variadic the grouping expression
리턴 Select instance

addSelect() 공개 메소드

Example $sb = new Select(); $sb ->select('u.id') ->addSelect('p.id') ->from('users', 'u') ->leftJoin('u', 'phone', 'u.id = p.user_id');
public addSelect ( string $select ) : Select
$select string the selection expression
리턴 Select instance

andHaving() 공개 메소드

Adds a restriction over the groups of the query, forming a logical conjunction with any existing having restrictions
public andHaving ( variadic $condition ) : Select
$condition variadic the query restriction predicates
리턴 Select

execute() 공개 메소드

public execute ( integer | string | object $fetchType = null ) : integer | string | array
$fetchType integer | string | object
리턴 integer | string | array

getSQLForJoins() 보호된 메소드

Generate SQL string for JOINs
protected getSQLForJoins ( string $fromAlias ) : string
$fromAlias string alias of table
리턴 string

getSql() 공개 메소드

public getSql ( ) : string
리턴 string

groupBy() 공개 메소드

Replaces any previously specified groupings, if any. Example $sb = new Select(); $sb ->select('u.name') ->from('users', 'u') ->groupBy('u.id');
public groupBy ( variadic $groupBy ) : Select
$groupBy variadic the grouping expression
리턴 Select instance

having() 공개 메소드

Replaces any previous having restrictions, if any
public having ( variadic $condition ) : Select
$condition variadic the query restriction predicates
리턴 Select

innerJoin() 공개 메소드

Example $sb = new Select(); $sb ->select('u.name') ->from('users', 'u') ->innerJoin('u', 'phone', 'p', 'p.is_primary = 1');
public innerJoin ( string $fromAlias, string $join, string $alias, string $condition = null ) : Select
$fromAlias string the alias that points to a from clause
$join string the table name to join
$alias string the alias of the join table
$condition string the condition for the join
리턴 Select instance

join() 공개 메소드

Example $sb = new Select(); $sb ->select('u.name') ->from('users', 'u') ->join('u', 'phone', 'p', 'p.is_primary = 1');
public join ( string $fromAlias, string $join, string $alias, string $condition = null ) : Select
$fromAlias string the alias that points to a from clause
$join string the table name to join
$alias string the alias of the join table
$condition string the condition for the join
리턴 Select instance

leftJoin() 공개 메소드

Example $sb = new Select(); $sb ->select('u.name') ->from('users', 'u') ->leftJoin('u', 'phone', 'p', 'p.is_primary = 1');
public leftJoin ( string $fromAlias, string $join, string $alias, string $condition = null ) : Select
$fromAlias string the alias that points to a from clause
$join string the table name to join
$alias string the alias of the join table
$condition string the condition for the join
리턴 Select instance

orHaving() 공개 메소드

Adds a restriction over the groups of the query, forming a logical disjunction with any existing having restrictions
public orHaving ( variadic $condition ) : Select
$condition variadic the query restriction predicates
리턴 Select

rightJoin() 공개 메소드

Example $sb = new Select(); $sb ->select('u.name') ->from('users', 'u') ->rightJoin('u', 'phone', 'p', 'p.is_primary = 1');
public rightJoin ( string $fromAlias, string $join, string $alias, string $condition = null ) : Select
$fromAlias string the alias that points to a from clause
$join string the table name to join
$alias string the alias of the join table
$condition string the condition for the join
리턴 Select instance

select() 공개 메소드

Example $sb = new Select(); $sb ->select('u.id', 'p.id') ->from('users', 'u') ->leftJoin('u', 'phone', 'p', 'u.id = p.user_id');
public select ( variadic $select ) : Select
$select variadic the selection expressions
리턴 Select instance

setFetchType() 공개 메소드

Setup fetch type, any of PDO, or any Class
public setFetchType ( string $fetchType ) : Select
$fetchType string
리턴 Select instance

setPage() 공개 메소드

Setup offset like a page number, start from 1
public setPage ( integer $page = 1 ) : Select
$page integer
리턴 Select

프로퍼티 상세

$fetchType 보호되어 있는 프로퍼티

PDO fetch types or object class
protected $fetchType