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

$dbType

$dbType : integer

Database type

Type

integer

$idQuoteType

$idQuoteType : string

ID quote type

Type

string

$placeholder

$placeholder : string

SQL placeholder

Type

string

$table

$table : string

Database table

Type

string

$divide

$divide : integer

Divide INSERT groups by # (0 creates one big INSERT statement, 1 creates an INSERT statement per row)

Type

integer

$sql

$sql : string

SQL string

Type

string

Methods

__construct()

__construct(\Pop\Db\Adapter\AbstractAdapter  $db, string  $table = 'pop_db_data', integer  $divide = 1) 

Constructor

Instantiate the SQL object

Parameters

\Pop\Db\Adapter\AbstractAdapter $db
string $table
integer $divide

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

setDivide()

setDivide(integer  $divide) : \Pop\Db\Sql\Data

Set the INSERT divide

Parameters

integer $divide

Returns

\Pop\Db\Sql\Data

getDivide()

getDivide() : integer

Get the INSERT divide

Returns

integer

setTable()

setTable(string  $table) : \Pop\Db\Sql\Data

Set the database table

Parameters

string $table

Returns

\Pop\Db\Sql\Data

getTable()

getTable() : string

Get the database table

Returns

string

getSql()

getSql() : string

Get SQL string

Returns

string

isSerialized()

isSerialized() : boolean

Check if data was serialized into SQL

Returns

boolean

serialize()

serialize(array  $data, mixed  $omit = null, boolean  $nullEmpty = false) : string

Serialize the data into INSERT statements

Parameters

array $data
mixed $omit
boolean $nullEmpty

Returns

string

writeToFile()

writeToFile(string  $to, string  $header = null, string  $footer = null) : void

Output SQL to a file

Parameters

string $to
string $header
string $footer

streamToFile()

streamToFile(array  $data, string  $to, mixed  $omit = null, boolean  $nullEmpty = false, string  $header = null, string  $footer = null) : void

Serialize the data into INSERT statements

Parameters

array $data
string $to
mixed $omit
boolean $nullEmpty
string $header
string $footer

__toString()

__toString() : string

__toString magic method

Returns

string