Documentation

DB2Connection
in package
implements Connection, ServerInfoAwareConnection

Interfaces, Classes and Traits

Connection
Connection interface.
ServerInfoAwareConnection
Contract for a connection that is able to provide information about the server it is connected to.

Table of Contents

$_conn  : resource
__construct()  : mixed
beginTransaction()  : bool
Initiates a transaction.
commit()  : bool
Commits a transaction.
errorCode()  : string|null
Returns the error code associated with the last operation on the database handle.
errorInfo()  : array<string|int, mixed>
Returns extended error information associated with the last operation on the database handle.
exec()  : int
Executes an SQL statement and return the number of affected rows.
getServerVersion()  : string
Returns the version number of the database server connected to.
lastInsertId()  : string
Returns the ID of the last inserted row or sequence value.
prepare()  : Statement
Prepares a statement for execution and returns a Statement object.
query()  : Statement
Executes an SQL statement, returning a result set as a Statement object.
quote()  : string
Quotes a string for use in a query.
requiresQueryForServerVersion()  : bool
Checks whether a query is required to retrieve the database server version.
rollBack()  : bool
Rolls back the current transaction, as initiated by beginTransaction().

Properties

Methods

__construct()

public __construct(array<string|int, mixed> $params, string $username, string $password[, array<string|int, mixed> $driverOptions = array() ]) : mixed
Parameters
$params : array<string|int, mixed>
$username : string
$password : string
$driverOptions : array<string|int, mixed> = array()
Tags
throws
DB2Exception
Return values
mixed

beginTransaction()

Initiates a transaction.

public beginTransaction() : bool
Return values
bool

TRUE on success or FALSE on failure.

commit()

Commits a transaction.

public commit() : bool
Return values
bool

TRUE on success or FALSE on failure.

errorCode()

Returns the error code associated with the last operation on the database handle.

public errorCode() : string|null
Return values
string|null

The error code, or null if no operation has been run on the database handle.

errorInfo()

Returns extended error information associated with the last operation on the database handle.

public errorInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

exec()

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

public exec(mixed $statement) : int
Parameters
$statement : mixed
Return values
int

getServerVersion()

Returns the version number of the database server connected to.

public getServerVersion() : string
Return values
string

lastInsertId()

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

public lastInsertId([mixed $name = null ]) : string
Parameters
$name : mixed = null
Return values
string

prepare()

Prepares a statement for execution and returns a Statement object.

public prepare(mixed $sql) : Statement
Parameters
$sql : mixed
Return values
Statement

quote()

Quotes a string for use in a query.

public quote(mixed $input[, mixed $type = PDO::PARAM_STR ]) : string
Parameters
$input : mixed
$type : mixed = PDO::PARAM_STR
Return values
string

requiresQueryForServerVersion()

Checks whether a query is required to retrieve the database server version.

public requiresQueryForServerVersion() : bool
Return values
bool

True if a query is required to retrieve the database server version, false otherwise.

rollBack()

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

public rollBack() : bool
Return values
bool

TRUE on success or FALSE on failure.

Search results