Session::getDefaultSchema

(No version information available, might only be in Git)

Session::getDefaultSchemaデフォルトのスキーマ名を取得する

説明

public mysql_xdevapi\Session::getDefaultSchema(): string

通常接続URIに設定される、デフォルトのスキーマ名を取得します。

パラメータ

この関数にはパラメータはありません。

戻り値

接続に定義されているデフォルトのスキーマ名を返します。 設定されていない場合は、null を返します。

例1 mysql_xdevapi\Session::getSchema() の例

<?php
$uri
= "mysqlx://testuser:testpasswd@localhost:33160/testx?ssl-mode=disabled";
$session = mysql_xdevapi\getSession($uri);

$schema = $session->getDefaultSchema();
echo
$schema;
?>

上の例の出力は以下となります。

testx
add a note

User Contributed Notes 1 note

up
0
shaun at shaunfreeman dot co dot uk
5 years ago
This method actually returns a Schema object that was named in the connection string or NULL<?php$session = mysql_xdevapi\getSession('mysqlzx://dbuser:654321@mysql:33060/dbname');/** @var Schema $defaultSchema */$defaultSchema = $session->getDefaultSchema();print "<pre>";print_r($defaultSchema);?>will output:mysql_xdevapi\Schema Object([name] => dbname)
To Top