Session::getDefaultSchema

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

Session::getDefaultSchema โ€” Get default schema name

่ฏดๆ˜Ž

public mysql_xdevapi\Session::getDefaultSchema(): ?mysql_xdevapi\Schema

Retrieve the default schema that's typically set in the connection URI.

ๅ‚ๆ•ฐ

ๆญคๅ‡ฝๆ•ฐๆฒกๆœ‰ๅ‚ๆ•ฐใ€‚

่ฟ”ๅ›žๅ€ผ

The default schema defined by the connection, or null if one was not set.

็คบไพ‹

็คบไพ‹ #1 mysql_xdevapi\Session::getSchema() example

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

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

ไปฅไธŠ็คบไพ‹ไผš่พ“ๅ‡บ๏ผš

testx
๏ผ‹ๆทปๅŠ ๅค‡ๆณจ

็”จๆˆท่ดก็Œฎ็š„ๅค‡ๆณจ 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