Connection.this

Construct opened connection.

Throws mysql.exceptions.MYX upon failure to connect.

If you are using Vibe.d, consider using mysql.pool.MySQLPool instead of creating a new Connection directly. That will provide certain benefits, such as reusing old connections and automatic cleanup (no need to close the connection when done).

// Suggested usage:

{
    auto con = new Connection("host=localhost;port=3306;user=joe;pwd=pass123;db=myappsdb");
    scope(exit) con.close();

    // Use the connection
    ...
}

Parameters

cs string

A connection string of the form "host=localhost;user=user;pwd=password;db=mysqld" (TODO: The connection string needs work to allow for semicolons in its parts!)

socketType MySQLSocketType

Whether to use a Phobos or Vibe.d socket. Default is Phobos, unless compiled with -version=Have_vibe_d_core (set automatically if using DUB).

capFlags SvrCapFlags

The set of flag bits from the server's capabilities that the client requires

Meta