AsyncMysqlConnection::serverInfo

Description

public function serverInfo(): string

The MySQL server version associated with the current connection.

Return Values

  • 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.

<?hh

namespace Hack\UserDocumentation\API\Examples\AsyncMysql\Conn\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(array());
  $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"