Constants

MYSQL

MYSQL

Constant for MYSQL database type

ORACLE

ORACLE

Constant for Oracle database type

PGSQL

PGSQL

Constant for PGSQL database type

SQLITE

SQLITE

Constant for SQLITE database type

SQLSRV

SQLSRV

Constant for SQLSRV database type

BACKTICK

BACKTICK

Constant for backtick quote id type

BRACKET

BRACKET

Constant for bracket quote id type

DOUBLE_QUOTE

DOUBLE_QUOTE

Constant for double quote id type

NO_QUOTE

NO_QUOTE

Constant for double quote id type

Properties

$dbType

$dbType : integer

Database type

Type

integer

$quoteIdType

$quoteIdType : string

ID quote type

Type

string

$table

$table : string

Current table

Type

string

$alias

$alias : string

Alias name for sub-queries

Type

string

$sql

$sql : string

SQL statement

Type

string

$placeholder

$placeholder : string

SQL placeholder

Type

string

Methods

__construct()

__construct(\Pop\Db\Adapter\AdapterInterface  $db, mixed  $table = null, string  $alias = null) : \Pop\Db\Sql

Constructor

Instantiate the SQL object.

Parameters

\Pop\Db\Adapter\AdapterInterface $db
mixed $table
string $alias

Returns

\Pop\Db\Sql

setQuoteId()

setQuoteId(string  $type = \Pop\Db\Sql::NO_QUOTE) : \Pop\Db\Sql

Set the quote ID type

Parameters

string $type

Returns

\Pop\Db\Sql

setTable()

setTable(mixed  $table = null) : \Pop\Db\Sql

Set current table to operate on.

Parameters

mixed $table

Returns

\Pop\Db\Sql

from()

from(mixed  $table = null) : \Pop\Db\Sql

Set current table to operate on. (alias for setTable)

Parameters

mixed $table

Returns

\Pop\Db\Sql

into()

into(mixed  $table = null) : \Pop\Db\Sql

Set current table to operate on. (alias for setTable)

Parameters

mixed $table

Returns

\Pop\Db\Sql

setAlias()

setAlias(string  $alias = null) : \Pop\Db\Sql

Set alias name

Parameters

string $alias

Returns

\Pop\Db\Sql

hasTable()

hasTable() : boolean

Determine if the Sql object has a table set

Returns

boolean

hasAlias()

hasAlias() : boolean

Determine if the Sql object has an alias name

Returns

boolean

getDbType()

getDbType() : integer

Get the current database type.

Returns

integer

getQuoteId()

getQuoteId() : integer

Get the quote ID type

Returns

integer

getTable()

getTable() : string

Get the current table.

Returns

string

getAlias()

getAlias() : string

Get the alias name.

Returns

string

getSql()

getSql() : string

Get the current SQL statement string.

Returns

string

getPlaceholder()

getPlaceholder() : string

Get the SQL placeholder.

Returns

string

quoteId()

quoteId(string  $value) : string

Quote the value with the quoted identifier

Parameters

string $value

Returns

string

quote()

quote(string  $value) : string

Quote the value with single quotes

Parameters

string $value

Returns

string

select()

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

Create a select statement

Parameters

mixed $columns

Returns

\Pop\Db\Sql\Select

insert()

insert(mixed  $columns = null) : \Pop\Db\Sql\Insert

Create a insert statement

Parameters

mixed $columns

Throws

\Pop\Db\Exception

Returns

\Pop\Db\Sql\Insert

update()

update(mixed  $columns = null) : \Pop\Db\Sql\Update

Create a update statement

Parameters

mixed $columns

Throws

\Pop\Db\Exception

Returns

\Pop\Db\Sql\Update

delete()

delete(mixed  $delete = null) : \Pop\Db\Sql\Update

Create a delete statement

Parameters

mixed $delete

Returns

\Pop\Db\Sql\Update

render()

render(boolean  $ret = false) : mixed

Render SQL string

Parameters

boolean $ret

Throws

\Pop\Db\Exception

Returns

mixed

__toString()

__toString() : string

Return the SQL as a string

Returns

string