(沒有版本資訊,可能只在 Git 中)
Schema::getCollections — 取得所有結構描述集合
此函式沒有參數。
此結構描述中所有集合的陣列,其中每個陣列元素值是一個 Collection 物件,以集合名稱作為鍵值。
範例 #1 mysql_xdevapi\Schema::getCollections() 範例
<?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");
$collect = $schema->createCollection("people");
$collect->add('{"name": "Fred", "age": 21, "job": "Construction"}')->execute();
$collect->add('{"name": "Wilma", "age": 23, "job": "Teacher"}')->execute();
$collections = $schema->getCollections();
var_dump($collections);
?>
上述範例將會輸出類似以下的內容:
array(1) { ["people"]=> object(mysql_xdevapi\Collection)#4 (1) { ["name"]=> string(6) "people" } }