Documentation

Select extends AbstractPredicateClause
in package

Select class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2021 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
5.3.0

Table of Contents

BACKTICK  = 'BACKTICK'
Constants for id quote types
BRACKET  = 'BRACKET'
DOUBLE_QUOTE  = 'DOUBLE_QUOTE'
MYSQL  = 'MYSQL'
Constants for database types
NO_QUOTE  = 'NO_QUOTE'
PGSQL  = 'PGSQL'
SQLITE  = 'SQLITE'
SQLSRV  = 'SQLSRV'
$aggregateFunctions  : array<string|int, mixed>
Supported standard SQL aggregate functions
$alias  : string
Alias
$closeQuote  : string
ID close quote
$db  : AbstractAdapter
Database object
$dbType  : int
Database type
$distinct  : bool
Distinct keyword
$groupBy  : string
GROUP BY value
$having  : Having
HAVING predicate object
$idQuoteType  : string
ID quote type
$joins  : array<string|int, mixed>
Joins
$limit  : mixed
LIMIT value
$mathFunctions  : array<string|int, mixed>
Supported standard SQL math functions
$offset  : int
OFFSET value
$openQuote  : string
ID open quote
$orderBy  : string
ORDER BY value
$parameterCount  : int
Parameter count
$placeholder  : string
SQL placeholder
$stringFunctions  : array<string|int, mixed>
Supported standard SQL string functions
$table  : mixed
Table
$values  : array<string|int, mixed>
Values
$where  : Where
WHERE predicate object
__construct()  : mixed
Constructor
__get()  : mixed
Magic method to access $where and $having properties
__toString()  : string
Render the SELECT statement
addNamedValue()  : AbstractSql
Add a named value
addValue()  : AbstractSql
Add a value
andHaving()  : Select
Access the HAVING clause with AND
andWhere()  : AbstractPredicateClause
Access the WHERE clause with AND
asAlias()  : Select
Set table AS alias name
db()  : AbstractAdapter
Get the current database adapter object (alias method)
decrementParameterCount()  : static
Decrement parameter count
distinct()  : Select
Select distinct
from()  : Select
Set from table
fullInnerJoin()  : Select
Add a FULL INNER JOIN clause
fullJoin()  : Select
Add a FULL JOIN clause
fullOuterJoin()  : Select
Add a FULL OUTER JOIN clause
getAlias()  : string
Get the alias
getCloseQuote()  : string
Get close quote
getDb()  : AbstractAdapter
Get the current database adapter object
getDbType()  : int
Get the current database type
getIdQuoteType()  : int
Get the quote ID type
getOpenQuote()  : string
Get open quote
getParameter()  : string
Get parameter placeholder value
getParameterCount()  : int
Get parameter count
getPlaceholder()  : string
Get the SQL placeholder
getTable()  : string
Get the table
getValue()  : mixed
Get a value
getValues()  : array<string|int, mixed>
Get the values
groupBy()  : Select
Set the GROUP BY value
hasAlias()  : bool
Determine if there is an alias
having()  : Select
Access the HAVING clause
incrementParameterCount()  : static
Increment parameter count
innerJoin()  : Select
Add a INNER JOIN clause
isMysql()  : bool
Determine if the DB type is MySQL
isParameter()  : bool
Check if value is parameter placeholder
isPgsql()  : bool
Determine if the DB type is PostgreSQL
isSqlite()  : bool
Determine if the DB type is SQLite
isSqlsrv()  : bool
Determine if the DB type is SQL Server
isSupportedFunction()  : bool
Check if value contains a standard SQL supported function
join()  : Select
Add a JOIN clause
leftInnerJoin()  : Select
Add a LEFT INNER JOIN clause
leftJoin()  : Select
Add a LEFT JOIN clause
leftOuterJoin()  : Select
Add a LEFT OUTER JOIN clause
limit()  : Select
Set the LIMIT value
offset()  : Select
Set the OFFSET value
orderBy()  : Select
Set the ORDER BY value
orHaving()  : Select
Access the HAVING clause with OR
orWhere()  : AbstractPredicateClause
Access the WHERE clause with OR
outerJoin()  : Select
Add a OUTER JOIN clause
quote()  : string
Quote the value (if it is not a numeric value)
quoteId()  : string
Quote the identifier
render()  : string
Render the SELECT statement
rightInnerJoin()  : Select
Add a RIGHT INNER JOIN clause
rightJoin()  : Select
Add a RIGHT JOIN clause
rightOuterJoin()  : Select
Add a RIGHT OUTER JOIN clause
setAlias()  : AbstractSql
Set the alias
setIdQuoteType()  : AbstractSql
Set the quote ID type
setPlaceholder()  : AbstractSql
Set the placeholder
setTable()  : AbstractSql
Set the table
setValues()  : AbstractSql
Set the values
where()  : AbstractPredicateClause
Access the WHERE clause
buildSqlSrvLimitAndOffset()  : string
Method to build SQL Server limit and offset sub-clause
getLimitAndOffset()  : array<string|int, mixed>
Method to get the limit and offset
init()  : void
Initialize SQL object
initQuoteType()  : void
Initialize quite type

Constants

BACKTICK

Constants for id quote types

public mixed BACKTICK = 'BACKTICK'

DOUBLE_QUOTE

public mixed DOUBLE_QUOTE = 'DOUBLE_QUOTE'

MYSQL

Constants for database types

public mixed MYSQL = 'MYSQL'

Properties

$aggregateFunctions

Supported standard SQL aggregate functions

protected static array<string|int, mixed> $aggregateFunctions = ['AVG', 'COUNT', 'MAX', 'MIN', 'SUM']

$closeQuote

ID close quote

protected string $closeQuote = null

$distinct

Distinct keyword

protected bool $distinct = false

$groupBy

GROUP BY value

protected string $groupBy = null

$having

HAVING predicate object

protected Having $having = null

$idQuoteType

ID quote type

protected string $idQuoteType = 'NO_QUOTE'

$joins

Joins

protected array<string|int, mixed> $joins = []

$limit

LIMIT value

protected mixed $limit = null

$mathFunctions

Supported standard SQL math functions

protected static array<string|int, mixed> $mathFunctions = ['ABS', 'RAND', 'SQRT', 'POW', 'POWER', 'EXP', 'LN', 'LOG', 'LOG10', 'GREATEST', 'LEAST', 'DIV', 'MOD', 'ROUND', 'TRUNC', 'CEIL', 'CEILING', 'FLOOR', 'COS', 'ACOS', 'ACOSH', 'SIN', 'SINH', 'ASIN', 'ASINH', 'TAN', 'TANH', 'ATANH', 'ATAN2']

$offset

OFFSET value

protected int $offset = null

$openQuote

ID open quote

protected string $openQuote = null

$orderBy

ORDER BY value

protected string $orderBy = null

$parameterCount

Parameter count

protected int $parameterCount = 0

$placeholder

SQL placeholder

protected string $placeholder = null

$stringFunctions

Supported standard SQL string functions

protected static array<string|int, mixed> $stringFunctions = ['CONCAT', 'FORMAT', 'INSTR', 'LCASE', 'LEFT', 'LENGTH', 'LOCATE', 'LOWER', 'LPAD', 'LTRIM', 'POSITION', 'QUOTE', 'REGEXP', 'REPEAT', 'REPLACE', 'REVERSE', 'RIGHT', 'RPAD', 'RTRIM', 'SPACE', 'STRCMP', 'SUBSTRING', 'SUBSTR', 'TRIM', 'UCASE', 'UPPER']

Methods

__get()

Magic method to access $where and $having properties

public __get(string $name) : mixed
Parameters
$name : string
Tags
throws
Exception
Return values
mixed

__toString()

Render the SELECT statement

public __toString() : string
Return values
string

andHaving()

Access the HAVING clause with AND

public andHaving([mixed $having = null ]) : Select
Parameters
$having : mixed = null
Return values
Select

asAlias()

Set table AS alias name

public asAlias(mixed $table) : Select
Parameters
$table : mixed
Return values
Select

decrementParameterCount()

Decrement parameter count

public decrementParameterCount() : static
Return values
static

distinct()

Select distinct

public distinct([bool $distinct = true ]) : Select
Parameters
$distinct : bool = true
Return values
Select

from()

Set from table

public from(mixed $table) : Select
Parameters
$table : mixed
Return values
Select

fullInnerJoin()

Add a FULL INNER JOIN clause

public fullInnerJoin(mixed $foreignTable, array<string|int, mixed> $columns) : Select
Parameters
$foreignTable : mixed
$columns : array<string|int, mixed>
Return values
Select

fullJoin()

Add a FULL JOIN clause

public fullJoin(mixed $foreignTable, array<string|int, mixed> $columns) : Select
Parameters
$foreignTable : mixed
$columns : array<string|int, mixed>
Return values
Select

fullOuterJoin()

Add a FULL OUTER JOIN clause

public fullOuterJoin(mixed $foreignTable, array<string|int, mixed> $columns) : Select
Parameters
$foreignTable : mixed
$columns : array<string|int, mixed>
Return values
Select

getAlias()

Get the alias

public getAlias() : string
Return values
string

getCloseQuote()

Get close quote

public getCloseQuote() : string
Return values
string

getDbType()

Get the current database type

public getDbType() : int
Return values
int

getIdQuoteType()

Get the quote ID type

public getIdQuoteType() : int
Return values
int

getOpenQuote()

Get open quote

public getOpenQuote() : string
Return values
string

getParameter()

Get parameter placeholder value

public getParameter(mixed $value[, string $column = null ]) : string
Parameters
$value : mixed
$column : string = null
Return values
string

getParameterCount()

Get parameter count

public getParameterCount() : int
Return values
int

getPlaceholder()

Get the SQL placeholder

public getPlaceholder() : string
Return values
string

getTable()

Get the table

public getTable() : string
Return values
string

getValue()

Get a value

public getValue(string $name) : mixed
Parameters
$name : string
Return values
mixed

getValues()

Get the values

public getValues() : array<string|int, mixed>
Return values
array<string|int, mixed>

groupBy()

Set the GROUP BY value

public groupBy(mixed $by) : Select
Parameters
$by : mixed
Return values
Select

hasAlias()

Determine if there is an alias

public hasAlias() : bool
Return values
bool

having()

Access the HAVING clause

public having([mixed $having = null ]) : Select
Parameters
$having : mixed = null
Return values
Select

incrementParameterCount()

Increment parameter count

public incrementParameterCount() : static
Return values
static

innerJoin()

Add a INNER JOIN clause

public innerJoin(mixed $foreignTable, array<string|int, mixed> $columns) : Select
Parameters
$foreignTable : mixed
$columns : array<string|int, mixed>
Return values
Select

isMysql()

Determine if the DB type is MySQL

public isMysql() : bool
Return values
bool

isParameter()

Check if value is parameter placeholder

public isParameter(mixed $value[, string $column = null ]) : bool
Parameters
$value : mixed
$column : string = null
Return values
bool

isPgsql()

Determine if the DB type is PostgreSQL

public isPgsql() : bool
Return values
bool

isSqlite()

Determine if the DB type is SQLite

public isSqlite() : bool
Return values
bool

isSqlsrv()

Determine if the DB type is SQL Server

public isSqlsrv() : bool
Return values
bool

isSupportedFunction()

Check if value contains a standard SQL supported function

public static isSupportedFunction(string $value) : bool
Parameters
$value : string
Return values
bool

join()

Add a JOIN clause

public join(mixed $foreignTable, array<string|int, mixed> $columns[, string $join = 'JOIN' ]) : Select
Parameters
$foreignTable : mixed
$columns : array<string|int, mixed>
$join : string = 'JOIN'
Return values
Select

leftInnerJoin()

Add a LEFT INNER JOIN clause

public leftInnerJoin(mixed $foreignTable, array<string|int, mixed> $columns) : Select
Parameters
$foreignTable : mixed
$columns : array<string|int, mixed>
Return values
Select

leftJoin()

Add a LEFT JOIN clause

public leftJoin(mixed $foreignTable, array<string|int, mixed> $columns) : Select
Parameters
$foreignTable : mixed
$columns : array<string|int, mixed>
Return values
Select

leftOuterJoin()

Add a LEFT OUTER JOIN clause

public leftOuterJoin(mixed $foreignTable, array<string|int, mixed> $columns) : Select
Parameters
$foreignTable : mixed
$columns : array<string|int, mixed>
Return values
Select

limit()

Set the LIMIT value

public limit(int $limit) : Select
Parameters
$limit : int
Return values
Select

offset()

Set the OFFSET value

public offset(int $offset) : Select
Parameters
$offset : int
Return values
Select

orderBy()

Set the ORDER BY value

public orderBy(mixed $by[, string $order = 'ASC' ]) : Select
Parameters
$by : mixed
$order : string = 'ASC'
Return values
Select

orHaving()

Access the HAVING clause with OR

public orHaving([mixed $having = null ]) : Select
Parameters
$having : mixed = null
Return values
Select

outerJoin()

Add a OUTER JOIN clause

public outerJoin(mixed $foreignTable, array<string|int, mixed> $columns) : Select
Parameters
$foreignTable : mixed
$columns : array<string|int, mixed>
Return values
Select

quote()

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

public quote(string $value[, bool $force = false ]) : string
Parameters
$value : string
$force : bool = false
Return values
string

quoteId()

Quote the identifier

public quoteId(string $identifier) : string
Parameters
$identifier : string
Return values
string

render()

Render the SELECT statement

public render() : string
Tags
throws
Exception
Return values
string

rightInnerJoin()

Add a RIGHT INNER JOIN clause

public rightInnerJoin(mixed $foreignTable, array<string|int, mixed> $columns) : Select
Parameters
$foreignTable : mixed
$columns : array<string|int, mixed>
Return values
Select

rightJoin()

Add a RIGHT JOIN clause

public rightJoin(mixed $foreignTable, array<string|int, mixed> $columns) : Select
Parameters
$foreignTable : mixed
$columns : array<string|int, mixed>
Return values
Select

rightOuterJoin()

Add a RIGHT OUTER JOIN clause

public rightOuterJoin(mixed $foreignTable, array<string|int, mixed> $columns) : Select
Parameters
$foreignTable : mixed
$columns : array<string|int, mixed>
Return values
Select

setIdQuoteType()

Set the quote ID type

public setIdQuoteType([string $type = self::NO_QUOTE ]) : AbstractSql
Parameters
$type : string = self::NO_QUOTE
Return values
AbstractSql

buildSqlSrvLimitAndOffset()

Method to build SQL Server limit and offset sub-clause

protected buildSqlSrvLimitAndOffset() : string
Return values
string

getLimitAndOffset()

Method to get the limit and offset

protected getLimitAndOffset() : array<string|int, mixed>
Return values
array<string|int, mixed>

init()

Initialize SQL object

protected init(string $adapter) : void
Parameters
$adapter : string
Return values
void

initQuoteType()

Initialize quite type

protected initQuoteType() : void
Return values
void

Search results