Constants

MYSQL

MYSQL

Constants for database types

PGSQL

PGSQL

SQLITE

SQLITE

SQLSRV

SQLSRV

BACKTICK

BACKTICK

Constants for id quote types

BRACKET

BRACKET

DOUBLE_QUOTE

DOUBLE_QUOTE

NO_QUOTE

NO_QUOTE

Properties

$table

$table : mixed

Table

Type

mixed

$alias

$alias : string

Alias

Type

string

$values

$values : array

Values

Type

array

$dbType

$dbType : integer

Database type

Type

integer

$idQuoteType

$idQuoteType : string

ID quote type

Type

string

$placeholder

$placeholder : string

SQL placeholder

Type

string

$allowedFunctions

$allowedFunctions : array

Allowed functions

Type

array

$distinct

$distinct : boolean

Distinct keyword

Type

boolean

$joins

$joins : array

Joins

Type

array

$groupBy

$groupBy : string

GROUP BY value

Type

string

$orderBy

$orderBy : string

ORDER BY value

Type

string

$limit

$limit : mixed

LIMIT value

Type

mixed

$offset

$offset : integer

OFFSET value

Type

integer

Methods

setTable()

setTable(mixed  $table) : \Pop\Db\Sql\AbstractSql

Set the table

Parameters

mixed $table

Returns

\Pop\Db\Sql\AbstractSql

hasAlias()

hasAlias() : boolean

Determine if there is an alias

Returns

boolean

getAlias()

getAlias() : string

Get the alias

Returns

string

setAlias()

setAlias(string  $alias) : \Pop\Db\Sql\AbstractSql

Set the alias

Parameters

string $alias

Returns

\Pop\Db\Sql\AbstractSql

getTable()

getTable() : string

Get the table

Returns

string

setValues()

setValues(array  $values) : \Pop\Db\Sql\AbstractSql

Set the values

Parameters

array $values

Returns

\Pop\Db\Sql\AbstractSql

addValue()

addValue(mixed  $value) : \Pop\Db\Sql\AbstractSql

Add a value

Parameters

mixed $value

Returns

\Pop\Db\Sql\AbstractSql

addNamedValue()

addNamedValue(string  $name, mixed  $value) : \Pop\Db\Sql\AbstractSql

Add a named value

Parameters

string $name
mixed $value

Returns

\Pop\Db\Sql\AbstractSql

getValues()

getValues() : array

Get the values

Returns

array

getValue()

getValue(string  $name) : mixed

Get a value

Parameters

string $name

Returns

mixed

render()

render() : string

Render the SELECT statement

Throws

\Pop\Db\Sql\Exception

Returns

string

isMysql()

isMysql() : boolean

Determine if the DB type is MySQL

Returns

boolean

isPgsql()

isPgsql() : boolean

Determine if the DB type is PostgreSQL

Returns

boolean

isSqlsrv()

isSqlsrv() : boolean

Determine if the DB type is SQL Server

Returns

boolean

isSqlite()

isSqlite() : boolean

Determine if the DB type is SQLite

Returns

boolean

setIdQuoteType()

setIdQuoteType(string  $type = self::NO_QUOTE) : \Pop\Db\Sql\AbstractSql

Set the quote ID type

Parameters

string $type

Returns

\Pop\Db\Sql\AbstractSql

setPlaceholder()

setPlaceholder(string  $placeholder) : \Pop\Db\Sql\AbstractSql

Set the placeholder

Parameters

string $placeholder

Returns

\Pop\Db\Sql\AbstractSql

getDbType()

getDbType() : integer

Get the current database type

Returns

integer

getIdQuoteType()

getIdQuoteType() : integer

Get the quote ID type

Returns

integer

getPlaceholder()

getPlaceholder() : string

Get the SQL placeholder

Returns

string

quoteId()

quoteId(string  $identifier) : string

Quote the identifier

Parameters

string $identifier

Returns

string

quote()

quote(string  $value) : string

Quote the value (if it is not a numeric value)

Parameters

string $value

Returns

string

distinct()

distinct(boolean  $distinct = true) : \Pop\Db\Sql\Select

Select distinct

Parameters

boolean $distinct

Returns

\Pop\Db\Sql\Select

from()

from(mixed  $table) : \Pop\Db\Sql\Select

Set from table

Parameters

mixed $table

Returns

\Pop\Db\Sql\Select

asAlias()

asAlias(mixed  $table) : \Pop\Db\Sql\Select

Set table AS alias name

Parameters

mixed $table

Returns

\Pop\Db\Sql\Select

join()

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

Add a JOIN clause

Parameters

mixed $foreignTable
array $columns
string $join

Returns

\Pop\Db\Sql\Select

leftJoin()

leftJoin(mixed  $foreignTable, array  $columns) : \Pop\Db\Sql\Select

Add a LEFT JOIN clause

Parameters

mixed $foreignTable
array $columns

Returns

\Pop\Db\Sql\Select

rightJoin()

rightJoin(mixed  $foreignTable, array  $columns) : \Pop\Db\Sql\Select

Add a RIGHT JOIN clause

Parameters

mixed $foreignTable
array $columns

Returns

\Pop\Db\Sql\Select

fullJoin()

fullJoin(mixed  $foreignTable, array  $columns) : \Pop\Db\Sql\Select

Add a FULL JOIN clause

Parameters

mixed $foreignTable
array $columns

Returns

\Pop\Db\Sql\Select

outerJoin()

outerJoin(mixed  $foreignTable, array  $columns) : \Pop\Db\Sql\Select

Add a OUTER JOIN clause

Parameters

mixed $foreignTable
array $columns

Returns

\Pop\Db\Sql\Select

leftOuterJoin()

leftOuterJoin(mixed  $foreignTable, array  $columns) : \Pop\Db\Sql\Select

Add a LEFT OUTER JOIN clause

Parameters

mixed $foreignTable
array $columns

Returns

\Pop\Db\Sql\Select

rightOuterJoin()

rightOuterJoin(mixed  $foreignTable, array  $columns) : \Pop\Db\Sql\Select

Add a RIGHT OUTER JOIN clause

Parameters

mixed $foreignTable
array $columns

Returns

\Pop\Db\Sql\Select

fullOuterJoin()

fullOuterJoin(mixed  $foreignTable, array  $columns) : \Pop\Db\Sql\Select

Add a FULL OUTER JOIN clause

Parameters

mixed $foreignTable
array $columns

Returns

\Pop\Db\Sql\Select

innerJoin()

innerJoin(mixed  $foreignTable, array  $columns) : \Pop\Db\Sql\Select

Add a INNER JOIN clause

Parameters

mixed $foreignTable
array $columns

Returns

\Pop\Db\Sql\Select

leftInnerJoin()

leftInnerJoin(mixed  $foreignTable, array  $columns) : \Pop\Db\Sql\Select

Add a LEFT INNER JOIN clause

Parameters

mixed $foreignTable
array $columns

Returns

\Pop\Db\Sql\Select

rightInnerJoin()

rightInnerJoin(mixed  $foreignTable, array  $columns) : \Pop\Db\Sql\Select

Add a RIGHT INNER JOIN clause

Parameters

mixed $foreignTable
array $columns

Returns

\Pop\Db\Sql\Select

fullInnerJoin()

fullInnerJoin(mixed  $foreignTable, array  $columns) : \Pop\Db\Sql\Select

Add a FULL INNER JOIN clause

Parameters

mixed $foreignTable
array $columns

Returns

\Pop\Db\Sql\Select

where()

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

Access the WHERE clause

Parameters

mixed $where

Returns

\Pop\Db\Sql\Select

andWhere()

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

Access the WHERE clause with AND

Parameters

mixed $where

Returns

\Pop\Db\Sql\Select

orWhere()

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

Access the WHERE clause with OR

Parameters

mixed $where

Returns

\Pop\Db\Sql\Select

having()

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

Access the HAVING clause

Parameters

mixed $having

Returns

\Pop\Db\Sql\Select

andHaving()

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

Access the HAVING clause with AND

Parameters

mixed $having

Returns

\Pop\Db\Sql\Select

orHaving()

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

Access the HAVING clause with OR

Parameters

mixed $having

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

orderBy()

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

Set the ORDER BY value

Parameters

mixed $by
string $order

Returns

\Pop\Db\Sql\Select

limit()

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

Set the LIMIT value

Parameters

mixed $limit

Returns

\Pop\Db\Sql\Select

offset()

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

Set the OFFSET value

Parameters

integer $offset

Returns

\Pop\Db\Sql\Select

__toString()

__toString() : string

Render the SELECT statement

Returns

string

__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

buildSqlSrvLimitAndOffset()

buildSqlSrvLimitAndOffset() : string

Method to build SQL Server limit and offset sub-clause

Returns

string