Index Documentation

IDbTransactions extends IDbConnection
in

Indicates supports for transactions in a database connection.

Table of Contents

Methods

beginTransaction()  : void
Enters a transaction.
close()  : void
Free, release or reset unmanaged resources.
commit()  : void
Commits the actions done during a transaction and ends the transaction.
execute()  : int|string
Executes a statement and returns how many rows are affected.
getAffectedRows()  : int|string
Gets the number of rows affected by the last operation.
getLastInsertId()  : int|string
Returns the ID of the last inserted row.
prepare()  : IDbStatement
Prepares a statement for execution and returns a database statement instance.
query()  : IDbResult
Executes a statement and returns a database result instance.
releaseSavePoint()  : void
Releases a save point.
rollback()  : void
Rolls back to the state before a transaction start or to a specified save point.
savePoint()  : void
Creates a save point in the transaction that can be rolled back to.
setAutoCommit()  : void
Sets whether changes should be applied immediately or whether commit should always be called first.

Methods

beginTransaction()

Enters a transaction.

public beginTransaction() : void
Tags
throws
RuntimeException

If the creation of the transaction failed.

close()

Free, release or reset unmanaged resources.

public close() : void

commit()

Commits the actions done during a transaction and ends the transaction.

public commit() : void

A new transaction will be started if auto-commit is disabled.

Tags
throws
RuntimeException

If the commit failed.

execute()

Executes a statement and returns how many rows are affected.

public execute(string $query) : int|string

Does not request results back from the database and thus should have better performance if the consumer doesn't care about them.

Parameters
$query : string

SQL query to execute.

Return values
int|string

Number of rows affected by the query.

getAffectedRows()

Gets the number of rows affected by the last operation.

public getAffectedRows() : int|string
Return values
int|string

Number of rows affected by the last operation.

getLastInsertId()

Returns the ID of the last inserted row.

public getLastInsertId() : int|string
Return values
int|string

Last inserted ID.

prepare()

Prepares a statement for execution and returns a database statement instance.

public prepare(string $query) : IDbStatement

The statement should use question mark (?) parameters.

Parameters
$query : string

SQL query to prepare.

Return values
IDbStatement

An instance of an implementation of IDbStatement.

query()

Executes a statement and returns a database result instance.

public query(string $query) : IDbResult
Parameters
$query : string

SQL query to execute.

Return values
IDbResult

An instance of an implementation of IDbResult

releaseSavePoint()

Releases a save point.

public releaseSavePoint(string $name) : void
Parameters
$name : string

Name of the save point.

Tags
throws
RuntimeException

If releasing the save point failed.

rollback()

Rolls back to the state before a transaction start or to a specified save point.

public rollback([string|null $name = null ]) : void
Parameters
$name : string|null = null

Name of the save point, null for the entire transaction.

Tags
throws
RuntimeException

If rollback failed.

savePoint()

Creates a save point in the transaction that can be rolled back to.

public savePoint(string $name) : void
Parameters
$name : string

Name for the save point.

Tags
throws
RuntimeException

If save point creation failed.

setAutoCommit()

Sets whether changes should be applied immediately or whether commit should always be called first.

public setAutoCommit(bool $state) : void
Parameters
$state : bool

true if things should automatically be committed, false if not.


        
On this page

Search results