- this
this(string host, string user, string password, string database, ushort port, uint maxConcurrent, SvrCapFlags capFlags, NewConnectionDelegate onNewConnection)
this(string host, string user, string password, string database, ushort port, SvrCapFlags capFlags, NewConnectionDelegate onNewConnection)
this(string host, string user, string password, string database, ushort port, NewConnectionDelegate onNewConnection)
this(string connStr, uint maxConcurrent, SvrCapFlags capFlags, NewConnectionDelegate onNewConnection)
this(string connStr, SvrCapFlags capFlags, NewConnectionDelegate onNewConnection)
this(string connStr, NewConnectionDelegate onNewConnection)
Sets up a connection pool with the provided connection settings.
- applyAuto
void applyAuto(T conn)
Applies any autoRegister/autoRelease settings to a connection,
if necessary.
- autoRegister
void autoRegister(SafePrepared prepared)
void autoRegister(UnsafePrepared prepared)
void autoRegister(const(char[]) sql)
Set a prepared statement to be automatically registered on all
connections received from this pool.
- autoRelease
void autoRelease(SafePrepared prepared)
void autoRelease(UnsafePrepared prepared)
void autoRelease(const(char[]) sql)
Set a prepared statement to be automatically released from all
connections received from this pool.
- clearAllRegistrations
void clearAllRegistrations()
Removes ALL prepared statement autoRegister and autoRelease which have been set.
- clearAuto
void clearAuto(SafePrepared prepared)
void clearAuto(UnsafePrepared prepared)
void clearAuto(const(char[]) sql)
Removes any autoRegister or autoRelease which may have been set
for this prepared statement.
- isAutoCleared
bool isAutoCleared(SafePrepared prepared)
bool isAutoCleared(const(char[]) sql)
bool isAutoCleared(Nullable!PreparedInfo info)
Is the given statement set for NEITHER auto-register
NOR auto-release on connections obtained from
this connection pool?
- isAutoRegistered
bool isAutoRegistered(SafePrepared prepared)
bool isAutoRegistered(UnsafePrepared prepared)
bool isAutoRegistered(const(char[]) sql)
bool isAutoRegistered(Nullable!PreparedInfo info)
Is the given statement set to be automatically registered on all
connections obtained from this connection pool?
- isAutoReleased
bool isAutoReleased(SafePrepared prepared)
bool isAutoReleased(UnsafePrepared prepared)
bool isAutoReleased(const(char[]) sql)
bool isAutoReleased(Nullable!PreparedInfo info)
Is the given statement set to be automatically released on all
connections obtained from this connection pool?
- lockConnection
LockedConnection!Connection lockConnection()
Obtain a connection. If one isn't available, a new one will be created.
- lockConnection
LockedConnection!Connection lockConnection()
Undocumented in source. Be warned that the author may not have intended to support it.
- removeUnusedConnections
void 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.
- removeUnusedConnections
void removeUnusedConnections()
Undocumented in source. Be warned that the author may not have intended to support it.
Connect to a MySQL/MariaDB database using a connection pool.
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.