Class MySQLPoolImpl

Connect to a MySQL/MariaDB database using a connection pool.

class MySQLPoolImpl(bool isSafe) ;

This provides various benefits over creating a new connection manually, such as automatically reusing old connections, and automatic cleanup (no need to close the connection when done).

Internally, this is based on vibe.d's ConnectionPool. You have to include vibe.d in your project to be able to use this class. If you don't want to, refer to mysql.connection.Connection.

You should not use this template directly, but rather import mysql.safe.pool or mysql.unsafe.pool or mysql.pool, which will alias MySQLPool to the correct instantiation. The boolean parameter here specifies whether the pool is operating in safe mode or unsafe mode.

Constructors

NameDescription
this (host, user, password, database, port, maxConcurrent, capFlags, onNewConnection) Sets up a connection pool with the provided connection settings.

Properties

NameTypeDescription
maxConcurrency[get, set] uintForwards to vibe.d's ConnectionPool.maxConcurrency
onNewConnection[get, set] NewConnectionDelegateGet/set a callback delegate to be run every time a new connection is created.

Methods

NameDescription
applyAuto (conn) Applies any autoRegister/autoRelease settings to a connection, if necessary.
autoRegister (prepared) Set a prepared statement to be automatically registered on all connections received from this pool.
autoRelease (prepared) Set a prepared statement to be automatically released from all connections received from this pool.
clearAllRegistrations () Removes ALL prepared statement autoRegister and autoRelease which have been set.
clearAuto (prepared) Removes any autoRegister or autoRelease which may have been set for this prepared statement.
isAutoCleared (prepared) Is the given statement set for NEITHER auto-register NOR auto-release on connections obtained from this connection pool?
isAutoRegistered (prepared) Is the given statement set to be automatically registered on all connections obtained from this connection pool?
isAutoReleased (prepared) Is the given statement set to be automatically released on all connections obtained from this connection pool?
lockConnection () Obtain a connection. If one isn't available, a new one will be created.
removeUnusedConnections () Removes all unused connections from the pool. This can be used to clean up before exiting the program to ensure the event core driver can be properly shut down.