AsyncMysqlConnection::serverInfo

The MySQL server version associated with the current connection

public function serverInfo(): string;

Returns

  • string - The server version as a string.

Examples

The following example shows how to get the version of the MySQL server that this connection is associated with via AsyncMysqlConnection::serverInfo.

use \Hack\UserDocumentation\API\Examples\AsyncMysql\ConnectionInfo as CI;

async function connect(
  \AsyncMysqlConnectionPool $pool,
): Awaitable<\AsyncMysqlConnection> {
  return await $pool->connect(
    CI::$host,
    CI::$port,
    CI::$db,
    CI::$user,
    CI::$passwd,
  );
}
async function get_server_info(): Awaitable<string> {
  $pool = new \AsyncMysqlConnectionPool(darray[]);
  $conn = await connect($pool);
  $info = $conn->serverInfo();
  $conn->close();
  return $info;
}

<<__EntryPoint>>
async function run(): Awaitable<void> {
  $info = await get_server_info();
  \var_dump($info);
}
```.hhvm.expectf
string(%d) "%s"
```.example.hhvm.out
string(23) "8.0.22-0ubuntu0.20.04.2"
```.skipif
await \Hack\UserDocumentation\API\Examples\AsyncMysql\skipif_async();