Index Documentation

MariaDBBackend
in package
implements IDbBackend

Information about the MariaDB/MySQL database layer.

Table of Contents

Interfaces

IDbBackend
Information about a database layer. Should not have any external dependencies.

Methods

createConnection()  : MariaDBConnection
Creates a connection with a MariaDB or MySQL server.
getClientVersion()  : string
Gets the version of the underlying client library.
isAvailable()  : bool
Checks whether the driver is available and a connection can be made.
parseDsn()  : MariaDBConnectionInfo
Constructs a connection info instance from a dsn.

Methods

getClientVersion()

Gets the version of the underlying client library.

public getClientVersion() : string
Return values
string

Version of the client library.

isAvailable()

Checks whether the driver is available and a connection can be made.

public isAvailable() : bool
Return values
bool

If true a connection can be made, if false a required extension is missing.

parseDsn()

Constructs a connection info instance from a dsn.

public parseDsn(string|array<string, int|string> $dsn) : MariaDBConnectionInfo

A username and password can be specified in their respective parts of the URL.

The host part of the URL can be any DNS name, or special value :unix:, documented further down.

The path part of the URL is used as the database name. Any prefix or suffix slashes (/) are trimmed and others are converted to an underscore (_). Meaning /slash/test/ is converted to slash_test.

In order to use a Unix socket path, set the host part to :unix: and specify socket=/path/to/socket.sock in the query.

Other supported query parameters are:

  • charset=<name>: Specifies the character set to use for the connection.
  • init=<query>: Any arbitrary SQL command to execute open connecting.
  • enc_key=<path>: Path to a private key file for SSL.
  • enc_cert=<path>: Path to a certificate file for SSL.
  • enc_authority=<path>: Path to a certificate authority file for SSL.
  • enc_trusted_certs=<path>: Path to a directory that contains PEM formatted SSL CA certificates.
  • enc_ciphers=<list>: A list of allowable ciphers to use for SSL encryption.
  • enc_no_verify: Disables verification of the server certificate, allows for MITM attacks.
  • compress: Enables protocol compression.

Previously supported query parameters:

  • enc_verify=<anything>: Enabled verification of server certificate. Replaced with enc_no_verify as it now defaults to on.
Parameters
$dsn : string|array<string, int|string>

DSN with connection information.

Return values
MariaDBConnectionInfo

MariaDB connection info.


        
On this page

Search results