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.

require __DIR__.'/../../__includes/async_mysql_connect.inc.php';

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;
}

function run(): void {
  $info = \HH\Asio\join(get_server_info());
  \var_dump($info);
}

run();
Output
string(13) "5.6.24-fb-log"