\Pop\Db\SqlSelect

Select SQL class

Summary

Methods
Properties
Constants
__construct()
setSql()
getSql()
orderBy()
limit()
offset()
render()
join()
distinct()
where()
groupBy()
having()
__get()
No public properties found
No constants found
getLimitAndOffset()
$columns
$sql
$orderBy
$limit
$offset
$functions
$allowedJoins
$distinct
$joins
$where
$groupBy
$having
N/A
No private methods found
No private properties found
N/A

Properties

$columns

$columns : array

SQL columns

Type

array

$orderBy

$orderBy : string

ORDER BY value

Type

string

$limit

$limit : mixed

LIMIT value

Type

mixed

$offset

$offset : integer

OFFSET value

Type

integer

$functions

$functions : array

SQL functions

Type

array

$allowedJoins

$allowedJoins : array

Allowed JOIN keywords

Type

array

$distinct

$distinct : boolean

Distinct keyword

Type

boolean

$joins

$joins : array

JOIN clauses

Type

array

$groupBy

$groupBy : string

GROUP BY value

Type

string

Methods

__construct()

__construct(\Pop\Db\Sql  $sql, mixed  $columns = null) : \Pop\Db\Sql\AbstractSql

Constructor

Instantiate the SQL object.

Parameters

\Pop\Db\Sql $sql
mixed $columns

Returns

\Pop\Db\Sql\AbstractSql

getSql()

getSql() : \Pop\Db\Sql

Set the SQL object

Returns

\Pop\Db\Sql

orderBy()

orderBy(mixed  $by, string  $order = 'ASC') : \Pop\Db\Sql\AbstractSql

Set the ORDER BY value

Parameters

mixed $by
string $order

Returns

\Pop\Db\Sql\AbstractSql

limit()

limit(mixed  $limit) : \Pop\Db\Sql\AbstractSql

Set the LIMIT value

Parameters

mixed $limit

Returns

\Pop\Db\Sql\AbstractSql

offset()

offset(integer  $offset) : \Pop\Db\Sql\AbstractSql

Set the OFFSET value

Parameters

integer $offset

Returns

\Pop\Db\Sql\AbstractSql

render()

render() : string

Render the SELECT statement

Throws

\Pop\Db\Sql\Exception

Returns

string

join()

join(string  $foreignTable, array  $columns, string  $typeOfJoin = 'LEFT JOIN') : \Pop\Db\Sql\Select

Set the JOIN clause

Parameters

string $foreignTable
array $columns
string $typeOfJoin

Returns

\Pop\Db\Sql\Select

distinct()

distinct() : \Pop\Db\Sql\Select

Set the DISTINCT keyword

Returns

\Pop\Db\Sql\Select

where()

where(mixed  $where = null) : \Pop\Db\Sql\Select

Set the WHERE clause

Parameters

mixed $where

Returns

\Pop\Db\Sql\Select

groupBy()

groupBy(mixed  $by) : \Pop\Db\Sql\Select

Set the GROUP BY value

Parameters

mixed $by

Returns

\Pop\Db\Sql\Select

having()

having(mixed  $having = null) : \Pop\Db\Sql\Having

Set the HAVING clause

Parameters

mixed $having

Returns

\Pop\Db\Sql\Having

__get()

__get(string  $name) : mixed

Magic method to access $where and $having properties

Parameters

string $name

Throws

\Pop\Db\Sql\Exception

Returns

mixed

getLimitAndOffset()

getLimitAndOffset() : array

Method to get the limit and offset

Returns

array