(沒有版本資訊,可能只存在於 Git 中)
Schema::__construct — Schema 建構式
Schema 物件提供對 schema (資料庫) 的完整存取權。
此函式沒有參數。
範例 #1 mysql_xdevapi\Schema::__construct() 範例
<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");
$session->sql("DROP DATABASE IF EXISTS food")->execute();
$session->sql("CREATE DATABASE food")->execute();
$session->sql("CREATE TABLE food.fruit(name text, rating text)")->execute();
$schema = $session->getSchema("food");
$schema->createCollection("trees");
print_r($schema->getTables());
print_r($schema->getCollections());
以上範例會輸出類似以下的內容:
Array ( [fruit] => mysql_xdevapi\Table Object ( [name] => fruit ) ) Array ( [trees] => mysql_xdevapi\Collection Object ( [name] => trees ) )