Documentation

Connection

Connection interface.

Driver connections must implement this interface.

Table of Contents

Methods

beginTransaction()  : bool
Initiates a transaction.
commit()  : bool
Commits a transaction.
exec()  : int
Executes an SQL statement and return the number of affected rows.
lastInsertId()  : string|int|false
Returns the ID of the last inserted row or sequence value.
prepare()  : Statement
Prepares a statement for execution and returns a Statement object.
query()  : Result
Executes an SQL statement, returning a result set as a Statement object.
quote()  : mixed
Quotes a string for use in a query.
rollBack()  : bool
Rolls back the current transaction, as initiated by beginTransaction().

Methods

beginTransaction()

Initiates a transaction.

public beginTransaction() : bool
Tags
throws
Exception
Return values
bool

TRUE on success or FALSE on failure.

commit()

Commits a transaction.

public commit() : bool
Tags
throws
Exception
Return values
bool

TRUE on success or FALSE on failure.

exec()

Executes an SQL statement and return the number of affected rows.

public exec(string $sql) : int
Parameters
$sql : string
Tags
throws
Exception
Return values
int

lastInsertId()

Returns the ID of the last inserted row or sequence value.

public lastInsertId([string|null $name = null ]) : string|int|false
Parameters
$name : string|null = null
Tags
throws
Exception
Return values
string|int|false

prepare()

Prepares a statement for execution and returns a Statement object.

public prepare(string $sql) : Statement
Parameters
$sql : string
Tags
throws
Exception
Return values
Statement

query()

Executes an SQL statement, returning a result set as a Statement object.

public query(string $sql) : Result
Parameters
$sql : string
Tags
throws
Exception
Return values
Result

quote()

Quotes a string for use in a query.

public quote(mixed $value[, int $type = ParameterType::STRING ]) : mixed

The usage of this method is discouraged. Use prepared statements or AbstractPlatform::quoteStringLiteral() instead.

Parameters
$value : mixed
$type : int = ParameterType::STRING

rollBack()

Rolls back the current transaction, as initiated by beginTransaction().

public rollBack() : bool
Tags
throws
Exception
Return values
bool

TRUE on success or FALSE on failure.


        
On this page

Search results