array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'mysql-xdevapi-schema.existsindatabase.php', 1 => 'Schema::existsInDatabase', ), 'up' => array ( 0 => 'class.mysql-xdevapi-schema.php', 1 => 'mysql_xdevapi\\Schema', ), 'prev' => array ( 0 => 'mysql-xdevapi-schema.dropcollection.php', 1 => 'Schema::dropCollection', ), 'next' => array ( 0 => 'mysql-xdevapi-schema.getcollection.php', 1 => 'Schema::getCollection', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/mysql_xdevapi/mysql_xdevapi/schema/existsindatabase.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(No version information available, might only be in Git)
Schema::existsInDatabase — データベースに存在するかをチェックする
現在のオブジェクト(スキーマ、テーブル、コレクション、またはビュー)が、 スキーマオブジェクト内に存在しているかを調べます。
この関数にはパラメータはありません。
例1 mysql_xdevapi\Schema::existsInDatabase() の例
<?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");
// ...
$trees = $schema->getCollection("trees");
// ...
// Is this collection still in the database (schema)?
if ($trees->existsInDatabase()) {
echo "Yes, the 'trees' collection is still present.";
}
上の例の出力は、 たとえば以下のようになります。
Yes, the 'trees' collection is still present.