Function MySQLPoolImpl.autoRegister
Set a prepared statement to be automatically registered on all connections received from this pool.
void autoRegister
(
SafePrepared prepared
) @safe;
void autoRegister
(
UnsafePrepared prepared
) @safe;
void autoRegister
(
const(char[]) sql
) @safe;
This also clears any autoRelease
which may have been set for this statement.
Calling this is not strictly necessary, as a prepared statement will
automatically be registered upon its first use on any Connection
.
This is provided for those who prefer eager registration over lazy
for performance reasons.
Once this has been called, obtaining a connection via lockConnection
will automatically register the prepared statement on the connection
if it isn't already registered on the connection. This single
registration safely persists after the connection is reclaimed by the
pool and locked again by another Vibe.d task.
Note, due to the way Vibe.d works, it is not possible to eagerly register or release a statement on all connections already sitting in the pool. This can only be done when locking a connection.
You can stop the pool from continuing to auto-register the statement
by calling either autoRelease
or clearAuto
.