Methods

getPrefix()

getPrefix() : string

Returns

string

execute()

execute(string  $type, string  $sql, array  $bind = array()) : integer

Parameters

string $type
string $sql
array $bind

Returns

integer

executeInsert()

executeInsert(string  $sql, array  $bind = array()) : integer

Parameters

string $sql
array $bind

Returns

integer

executeUpdate()

executeUpdate(string  $sql, array  $bind = array()) : integer

Parameters

string $sql
array $bind

Returns

integer

executeDelete()

executeDelete(string  $sql, array  $bind = array()) : integer

Parameters

string $sql
array $bind

Returns

integer

fetchOne()

fetchOne(string  $sql, array  $bind = array(), integer  $mode = \PDO::FETCH_ASSOC, boolean  $useMaster = false) : array|false

Returns the first row in a SQL query result

Parameters

string $sql
array $bind
integer $mode
boolean $useMaster

Returns

array|false

fetchAll()

fetchAll(string  $sql, array  $bind = array(), integer  $mode = \PDO::FETCH_ASSOC, boolean  $useMaster = false) : array

Dumps the complete result of a query into an array

Parameters

string $sql
array $bind
integer $mode
boolean $useMaster

Returns

array

insert()

insert(string  $table, array  $record, boolean  $fetchInsertId = false) : integer|string|null

Parameters

string $table
array $record
boolean $fetchInsertId

Throws

\ManaPHP\Data\Db\Exception

Returns

integer|string|null

insertBySql()

insertBySql(string  $table, string  $sql, array  $bind = array()) : integer

Parameters

string $table
string $sql
array $bind

Returns

integer

update()

update(string  $table, array  $fieldValues, string|array  $conditions, array  $bind = array()) : integer

Updates data on a table using custom SQL syntax

Parameters

string $table
array $fieldValues
string|array $conditions
array $bind

Returns

integer

updateBySql()

updateBySql(string  $table, string  $sql, array  $bind = array()) : integer

Updates data on a table using custom SQL syntax

Parameters

string $table
string $sql
array $bind

Returns

integer

upsert()

upsert(string  $table, array  $insertFieldValues, array  $updateFieldValues = array(), string  $primaryKey = null) : integer

Updates data on a table using custom SQL syntax

Parameters

string $table
array $insertFieldValues
array $updateFieldValues
string $primaryKey

Returns

integer

delete()

delete(string  $table, string|array  $conditions, array  $bind = array()) : integer

Deletes data from a table using custom SQL syntax

Parameters

string $table
string|array $conditions
array $bind

Returns

integer

deleteBySql()

deleteBySql(string  $table, string  $sql, array  $bind = array()) : integer

Deletes data from a table using custom SQL syntax

Parameters

string $table
string $sql
array $bind

Returns

integer

getSQL()

getSQL() : string

Active SQL statement in the object

Returns

string

getEmulatedSQL()

getEmulatedSQL(integer  $preservedStrLength = -1) : string

Active SQL statement in the object with replace the bind with value

Parameters

integer $preservedStrLength

Returns

string

getBind()

getBind() : array

Active SQL statement in the object

Returns

array

affectedRows()

affectedRows() : integer

Returns the number of affected rows by the last INSERT/UPDATE/DELETE reported by the database system

Returns

integer

begin()

begin() : void

Starts a transaction in the connection

isUnderTransaction()

isUnderTransaction() : boolean

Checks whether the connection is under a transaction

Returns

boolean

rollback()

rollback() : void

Rollbacks the active transaction in the connection

commit()

commit() : void

Commits the active transaction in the connection

getMetadata()

getMetadata(  $source) : array

Parameters

$source

Returns

array

getTables()

getTables(string  $schema = null) : array

Parameters

string $schema

Returns

array

buildSql()

buildSql(array  $params) : string

Parameters

array $params

Returns

string

getLastSql()

getLastSql() : string

Returns

string

query()

query(string  $table = null, string  $alias = null) : \ManaPHP\Data\Db\Query

Parameters

string $table
string $alias

Returns

\ManaPHP\Data\Db\Query