« Schema::existsInDatabase
Schema::getCollectionAsTable »

Schema::getCollection

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

Schema::getCollection — スキーマからコレクションを取得する

説明

public function mysql_xdevapi\Schema::getCollection(string $name): mysql_xdevapi\Collection

スキーマからコレクションを取得します。

パラメータ

name

取得するコレクションの名前

戻り値

選択したコレクションを指す Collection オブジェクトを返します。

例

例1 mysql_xdevapi\Schema::getCollection() の例

<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");

$session->sql("DROP DATABASE IF EXISTS food")->execute();
$session->sql("CREATE DATABASE food")->execute();

$schema = $session->getSchema("food");
$schema->createCollection("trees");

// ...

$trees = $schema->getCollection("trees");

var_dump($trees);

上の例の出力は、 たとえば以下のようになります。

object(mysql_xdevapi\Collection)#3 (1) {
  ["name"]=>
  string(5) "trees"
}
関連キーワード:
Schema   コレクション   mysql   xdevapi   getCollection   trees   スキーマ   session   Collection   food   schema   execute   existsInDatabase   getCollectionAsTable   information   available   選択   getSession   mysqlx   user   password   localhost   getSchema   createCollection   dump
関連する関数・ページ:
mysql-xdevapi-schema.existsindatabase   mysql-xdevapi-schema.construct   class.mysql-xdevapi-schema   mysql-xdevapi-schema.createcollection   mysql-xdevapi-schema.dropcollection   mysql-xdevapi-schema.getcollectionastable