PHP Class Mongo

Author: Johannes Skov Frandsen ([email protected])
Afficher le fichier Open project: alcaeus/mongo-php-adapter Class Usage Examples

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
connectUtil ( ) : boolean Connects with a database server
notImplemented ( )

Method Details

__construct() public méthode

Dummy constructor to throw an exception
public __construct ( )

connectUtil() protected méthode

Connects with a database server
protected connectUtil ( ) : boolean
Résultat boolean If the connection was successful.

forceError() public méthode

Creates a database error on the database.
Deprecation: Use MongoDB::forceError() instead.
public forceError ( ) : boolean
Résultat boolean The database response.

getPoolSize() public méthode

Get pool size for connection pools
Deprecation: 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
Résultat integer Returns the current pool size.

getSlave() public méthode

Returns the address being used by this for slaveOkay reads
public getSlave ( ) : boolean
Résultat 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() public méthode

Get slaveOkay setting for this connection
public getSlaveOkay ( ) : boolean
Résultat boolean Returns the value of slaveOkay for this instance.

lastError() public méthode

Check if there was an error on the most recent db operation performed
Deprecation: Use MongoDB::lastError() instead.
public lastError ( ) : array | null
Résultat array | null Returns the error, if there was one, or NULL.

notImplemented() protected méthode

protected notImplemented ( )

pairConnect() public méthode

Connects to paired database server
Deprecation: Pass a string of the form "mongodb://server1,server2" to the constructor instead of using this method.
public pairConnect ( ) : boolean
Résultat boolean

pairPersistConnect() public méthode

Creates a persistent connection with paired database servers
Deprecation: 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.
Résultat boolean If the connection was successful.

persistConnect() public méthode

Creates a persistent connection with a database server
Deprecation: 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.
Résultat boolean If the connection was successful.

poolDebug() public méthode

Returns information about all connection pools.
Deprecation: 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
Résultat array

prevError() public méthode

Checks for the last error thrown during a database operation
Deprecation: Use MongoDB::prevError() instead.
public prevError ( ) : array
Résultat array Returns the error and the number of operations ago it occurred.

resetError() public méthode

Clears any flagged errors on the connection
Deprecation: Use MongoDB::resetError() instead.
public resetError ( ) : array
Résultat array Returns the database response.

setPoolSize() public méthode

Set the size for future connection pools.
Deprecation: 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.

Résultat boolean Returns the former value of pool size.

setSlaveOkay() public méthode

Change slaveOkay setting for this connection
public setSlaveOkay ( boolean $ok ) : boolean
$ok boolean
Résultat boolean returns the former value of slaveOkay for this instance.

switchSlave() public méthode

Choose a new secondary for slaveOkay reads
public switchSlave ( ) : string
Résultat 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.