(無版本資訊,可能僅在 Git 中)
Collection::getSchema — 取得 schema 物件
擷取包含此集合的 schema 物件。
此函式沒有參數。
如果成功,則傳回 schema 物件,如果無法擷取指定集合的物件,則傳回 null
。
範例 #1 mysql_xdevapi\Collection::getSchema() 範例
<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");
$session->sql("DROP DATABASE IF EXISTS addressbook")->execute();
$session->sql("CREATE DATABASE addressbook")->execute();
$schema = $session->getSchema("addressbook");
$collection = $schema->createCollection("people");
var_dump($collection->getSchema());
?>
上述範例將輸出類似以下的內容
object(mysql_xdevapi\Schema)#9 (1) { ["name"]=> string(11) "addressbook" }