php8.5
Home/ Manual/ mysql_xdevapi / session/ Session::getDefaultSchema

Session::getDefaultSchema

PHP function Edit on GitHub ✎

Get default schema name

Description

mysql_xdevapi\Session::getDefaultSchema(): mysql_xdevapi\Schema|null

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

Parameters Parameters

Return Values

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

Examples

mysql_xdevapi\Session::getSchema() example

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

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

The above example will output:

output
testx

Source: reference/mysql_xdevapi/mysql_xdevapi/session/getdefaultschema.xml · from the official PHP manual (php/doc-en)