Bitrix API

ConnectionPool

Connection pool is a connections holder

Table of Contents

Constants

DEFAULT_CONNECTION_NAME  = "default"

Methods

__construct()  : mixed
Creates connection pool object
cloneConnection()  : Connection
Creates a new connection based on the supplied one.
disconnect()  : mixed
Disconnects all *database* connections.
getConnection()  : Connection|Connection|null
Returns database connection by its name. Creates new connection if necessary.
getSlaveConnection()  : Connection|null
Returns a slave connection or null if the query should go to the master.
ignoreDml()  : void
In the ignore DML mode a data modification command will not stop next queries going to a slave.
isMasterOnly()  : bool
Returns the state of queries balancing (is the master only can be used).
isSlavePossible()  : bool
Returns the state of queries balancing (is a slave still can be used).
setConnectionParameters()  : void
Sets named connection paramters.
useMasterOnly()  : void
In the master-only mode all queries will go to the master.

Constants

DEFAULT_CONNECTION_NAME

public mixed DEFAULT_CONNECTION_NAME = "default"

Methods

__construct()

Creates connection pool object

public __construct() : mixed

cloneConnection()

Creates a new connection based on the supplied one.

public cloneConnection(string $name, string $newName[, array<string|int, mixed> $parameters = [] ]) : Connection
Parameters
$name : string

Copy source.

$newName : string

Copy target.

$parameters : array<string|int, mixed> = []

Parameters to be passed to createConnection method.

Tags
throws
ConfigurationException
Return values
Connection

disconnect()

Disconnects all *database* connections.

public disconnect() : mixed

getSlaveConnection()

Returns a slave connection or null if the query should go to the master.

public getSlaveConnection(string $sql) : Connection|null
Parameters
$sql : string

A SQL string. Only SELECT will go to a slave.

Return values
Connection|null

ignoreDml()

In the ignore DML mode a data modification command will not stop next queries going to a slave.

public ignoreDml(bool $mode) : void
Parameters
$mode : bool

Ignore subsequent DML or not.

isMasterOnly()

Returns the state of queries balancing (is the master only can be used).

public isMasterOnly() : bool
Return values
bool

isSlavePossible()

Returns the state of queries balancing (is a slave still can be used).

public isSlavePossible() : bool
Return values
bool

setConnectionParameters()

Sets named connection paramters.

public setConnectionParameters(string $name, array<string|int, mixed> $parameters) : void
Parameters
$name : string

Name of the connection.

$parameters : array<string|int, mixed>

Parameters values.

useMasterOnly()

In the master-only mode all queries will go to the master.

public useMasterOnly(bool $mode) : void
Parameters
$mode : bool

True starts the mode and false ends.


        
On this page

Search results