mysql-native v3.0.0

API Reference Home: [This Version] [Latest Version] [Other Versions]


Class MySQLPool

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

class MySQLPool ;

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 Connection.

Constructors

NameDescription
this 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] void delegate(Connection)Get/set a callback delegate to be run every time a new connection is created.

Methods

NameDescription
autoRegister Set a prepared statement to be automatically registered on all connections received from this pool.
autoRelease 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 Removes any autoRegister or autoRelease which may have been set for this prepared statement.
isAutoCleared Is the given statement set for NEITHER auto-register NOR auto-release on connections obtained from this connection pool?
isAutoRegistered Is the given statement set to be automatically registered on all connections obtained from this connection pool?
isAutoReleased 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.