Documentation

COracleConnectionManager
in package
implements IConnectionManager

Oracle implementation of the connection manager.

Manages Oracle database connections using OCI8 functions.

Table of Contents

Interfaces

IConnectionManager
Interface for managing database connections pool.

Properties

$autocommit  : bool
$connection_params  : array<string, array<string|int, mixed>>
$connections  : array<string, mixed>
$default_key  : string|null

Methods

Connect()  : mixed
Establishes a new database connection.
Disconnect()  : void
Closes a specific database connection.
DisconnectAll()  : void
Closes all open database connections.
GetConnection()  : mixed
Retrieves a database connection handle.
GetConnectionError()  : int
Gets the last error number for a connection.
GetConnectionErrorString()  : string
Gets the last error string for a connection.
GetDbmsType()  : string
Get the name of DBMS used
GetDefaultKey()  : string|null
Gets the current default connection key.
HasConnection()  : bool
Checks if a connection exists and is active.
RealConnection()  : bool
Performs the actual connection based on the current parameters.
SetAutoCommit()  : void
Sets autocommit mode for connections.
SetDefaultKey()  : void
Sets the default connection key.
IsValidConnection()  : bool
Checks if a value is a valid OCI connection (resource or object in PHP 8.1+).
RealConnectionForKey()  : bool
Performs actual connection for a specific key.

Properties

$connection_params

protected array<string, array<string|int, mixed>> $connection_params = []

Stored parameters for lazy connections

Methods

Connect()

Establishes a new database connection.

public Connect(string $dbname, string $username, string $pwd, string $hostname, int|string $port) : mixed
Parameters
$dbname : string

Database name

$username : string

Database username

$pwd : string

Database password

$hostname : string

Database host

$port : int|string

Database port

Return values
mixed —

The connection handle

Disconnect()

Closes a specific database connection.

public Disconnect([string|null $connectionKey = null ]) : void
Parameters
$connectionKey : string|null = null

Connection identifier key, null for default

GetConnection()

Retrieves a database connection handle.

public GetConnection([string|null $connectionKey = null ]) : mixed
Parameters
$connectionKey : string|null = null

Connection identifier key, null for default

Return values
mixed —

The connection handle or null if not connected

GetConnectionError()

Gets the last error number for a connection.

public GetConnectionError([string|null $connectionKey = null ]) : int
Parameters
$connectionKey : string|null = null

Connection identifier key, null for default

Return values
int —

Error number, 0 if no error

GetConnectionErrorString()

Gets the last error string for a connection.

public GetConnectionErrorString([string|null $connectionKey = null ]) : string
Parameters
$connectionKey : string|null = null

Connection identifier key, null for default

Return values
string —

Error message

GetDbmsType()

Get the name of DBMS used

public GetDbmsType() : string
Return values
string —

the name of DBMS used. i.e.: mysql, oracle, postgresql (the convention is all in lowercase)

GetDefaultKey()

Gets the current default connection key.

public GetDefaultKey() : string|null
Return values
string|null —

The default connection key or null

HasConnection()

Checks if a connection exists and is active.

public HasConnection([string|null $connectionKey = null ]) : bool
Parameters
$connectionKey : string|null = null

Connection identifier key, null for default

Return values
bool —

True if connected, false otherwise

RealConnection()

Performs the actual connection based on the current parameters.

public RealConnection() : bool
Return values
bool —

True if connection successful

SetAutoCommit()

Sets autocommit mode for connections.

public SetAutoCommit(bool $autocommit) : void
Parameters
$autocommit : bool

True for autocommit, false for manual commit

SetDefaultKey()

Sets the default connection key.

public SetDefaultKey(string $connectionKey) : void
Parameters
$connectionKey : string

The connection key to set as default

IsValidConnection()

Checks if a value is a valid OCI connection (resource or object in PHP 8.1+).

protected IsValidConnection(mixed $value) : bool
Parameters
$value : mixed

The value to check

Return values
bool —

True if valid connection

RealConnectionForKey()

Performs actual connection for a specific key.

protected RealConnectionForKey(string $key) : bool
Parameters
$key : string

Connection key

Tags
throws
CConnectionException

If connection fails

Return values
bool —

True if successful


        
On this page

Search results