Function MySQLPoolImpl.lockConnection

Obtain a connection. If one isn't available, a new one will be created.

LockedConnection!Connection lockConnection() @safe;

The connection returned is actually a LockedConnection!Connection, but it uses alias this, and so can be used just like a Connection. (See vibe.d's LockedConnection documentation.)

No other fiber will be given this mysql.connection.Connection as long as your fiber still holds it.

There is no need to close, release or unlock this connection. It is reference-counted and will automatically be returned to the pool once your fiber is done with it.

If you have passed any prepared statements to autoRegister or autoRelease, then those statements will automatically be registered/released on the connection. (Currently, this automatic register/release may actually occur upon the first command sent via the connection.)