PHP Класс Mongo

Автор: Johannes Skov Frandsen ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( ) Dummy constructor to throw an exception
forceError ( ) : boolean Creates a database error on the database.
getPoolSize ( ) : integer Get pool size for connection pools
getSlave ( ) : boolean Returns the address being used by this for slaveOkay reads
getSlaveOkay ( ) : boolean Get slaveOkay setting for this connection
lastError ( ) : array | null Check if there was an error on the most recent db operation performed
pairConnect ( ) : boolean Connects to paired database server
pairPersistConnect ( string $username = "", string $password = "" ) : boolean Creates a persistent connection with paired database servers
persistConnect ( string $username = "", string $password = "" ) : boolean Creates a persistent connection with a database server
poolDebug ( ) : array Returns information about all connection pools.
prevError ( ) : array Checks for the last error thrown during a database operation
resetError ( ) : array Clears any flagged errors on the connection
setPoolSize ( $size ) : boolean Set the size for future connection pools.
setSlaveOkay ( boolean $ok ) : boolean Change slaveOkay setting for this connection
switchSlave ( ) : string Choose a new secondary for slaveOkay reads

Защищенные методы

Метод Описание
connectUtil ( ) : boolean Connects with a database server
notImplemented ( )

Описание методов

__construct() публичный Метод

Dummy constructor to throw an exception
public __construct ( )

connectUtil() защищенный Метод

Connects with a database server
protected connectUtil ( ) : boolean
Результат boolean If the connection was successful.

forceError() публичный Метод

Creates a database error on the database.
Устаревший: Use MongoDB::forceError() instead.
public forceError ( ) : boolean
Результат boolean The database response.

getPoolSize() публичный Метод

Get pool size for connection pools
Устаревший: This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::getSize() instead.
public getPoolSize ( ) : integer
Результат integer Returns the current pool size.

getSlave() публичный Метод

Returns the address being used by this for slaveOkay reads
public getSlave ( ) : boolean
Результат boolean The address of the secondary this connection is using for reads. This returns NULL if this is not connected to a replica set or not yet initialized.

getSlaveOkay() публичный Метод

Get slaveOkay setting for this connection
public getSlaveOkay ( ) : boolean
Результат boolean Returns the value of slaveOkay for this instance.

lastError() публичный Метод

Check if there was an error on the most recent db operation performed
Устаревший: Use MongoDB::lastError() instead.
public lastError ( ) : array | null
Результат array | null Returns the error, if there was one, or NULL.

notImplemented() защищенный Метод

protected notImplemented ( )

pairConnect() публичный Метод

Connects to paired database server
Устаревший: Pass a string of the form "mongodb://server1,server2" to the constructor instead of using this method.
public pairConnect ( ) : boolean
Результат boolean

pairPersistConnect() публичный Метод

Creates a persistent connection with paired database servers
Устаревший: Pass "mongodb://server1,server2" and array("persist" => $id) to the constructor instead of using this method.
public pairPersistConnect ( string $username = "", string $password = "" ) : boolean
$username string A username used to identify the connection.
$password string A password used to identify the connection.
Результат boolean If the connection was successful.

persistConnect() публичный Метод

Creates a persistent connection with a database server
Устаревший: Pass array("persist" => $id) to the constructor instead of using this method.
public persistConnect ( string $username = "", string $password = "" ) : boolean
$username string A username used to identify the connection.
$password string A password used to identify the connection.
Результат boolean If the connection was successful.

poolDebug() публичный Метод

Returns information about all connection pools.
Устаревший: This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::info() instead.
public poolDebug ( ) : array
Результат array

prevError() публичный Метод

Checks for the last error thrown during a database operation
Устаревший: Use MongoDB::prevError() instead.
public prevError ( ) : array
Результат array Returns the error and the number of operations ago it occurred.

resetError() публичный Метод

Clears any flagged errors on the connection
Устаревший: Use MongoDB::resetError() instead.
public resetError ( ) : array
Результат array Returns the database response.

setPoolSize() публичный Метод

Set the size for future connection pools.
Устаревший: Relying on this feature is highly discouraged. Please use MongoPool::setSize() instead.
public setPoolSize ( $size ) : boolean
$size

The max number of connections future pools will be able to create. Negative numbers mean that the pool will spawn an infinite number of connections.

Результат boolean Returns the former value of pool size.

setSlaveOkay() публичный Метод

Change slaveOkay setting for this connection
public setSlaveOkay ( boolean $ok ) : boolean
$ok boolean
Результат boolean returns the former value of slaveOkay for this instance.

switchSlave() публичный Метод

Choose a new secondary for slaveOkay reads
public switchSlave ( ) : string
Результат string The address of the secondary this connection is using for reads. This may be the same as the previous address as addresses are randomly chosen. It may return only one address if only one secondary (or only the primary) is available.