AsyncMysqlClient
An asynchronous MySQL client
This class allows you to asynchronously connect to a MySQL client. You
can directly connect to the MySQL client with the connect()
method; in
addition you can use this class in conjunction with
AsyncMysqlConnectionPool
pools by setting the limit of connections on
any given pool, and using AsyncMysqlConnectionPool::connect()
.
There is some duplication with this class. If possible, you should directly
construct connection pools via new AsyncMysqlConnectionPool()
and then
call AsyncMysqlConnectionPool::connect()
to connect to the MySQL client
using those pools. Here we optionally set pool limits and call connect()
on this class. AsyncMysqlConnectionPool
provides more flexibility with
other available options, etc.
In fact, there is discussion about deprecating AsyncMysqlClient
all
together to avoid having this choice. But, for now, you can use this class
for asynchronous connection(s) to a MySQL database.
Guides
Interface Synopsis
final class AsyncMysqlClient {...}
Public Methods
::connect(string $host, int $port, string $dbname, string $user, string $password, int $timeout_micros = -1, ?MySSLContextProvider $ssl_provider = NULL, int $tcp_timeout_micros = 0, string $sni_server_name = '', string $server_cert_extensions = '', string $server_cert_values = ''): Awaitable<AsyncMysqlConnection>
Begin an async connection to a MySQL instance::connectAndQuery(Traversable<string, arraykey> $queries, string $host, int $port, string $dbname, string $user, string $password, AsyncMysqlConnectionOptions $conn_opts, dict<string> $query_attributes = dict [ ]): Awaitable<(AsyncMysqlConnectResult, Vector<AsyncMysqlQueryResult>)>
Begin an async connection and query to a MySQL instance::connectWithOpts(string $host, int $port, string $dbname, string $user, string $password, AsyncMysqlConnectionOptions $conn_opts): Awaitable<AsyncMysqlConnection>
Begin an async connection to a MySQL instance::setPoolsConnectionLimit(int $limit): void
Sets the connection limit of all connection pools using this client