Collection::existsInDatabase
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
Collection::existsInDatabase
Референца за `mysql-xdevapi-collection.existsindatabase.php` со подобрена типографија и навигација.
Collection::existsInDatabase
(Нема достапни информации за верзијата, можеби е само во Git)
Collection::existsInDatabase — Check if collection exists in database
= NULL
Checks if the Collection object refers to a collection in the database (schema).
Параметри
Оваа функција нема параметри.
Вратени вредности
Патеката до PHP скриптата што треба да се провери. true if collection exists in the database, else false ако не е.
A table defined with two columns (doc and _id) is considered a collection, and a third _json_schema column as of MySQL 8.0.21. Adding an additional column means existsInDatabase() will no longer see it as a collection.
Примери
Пример #1 mysql_xdevapi\Collection::existsInDatabase() example
<?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");
$create = $schema->createCollection("people");
// ...
$collection = $schema->getCollection("people");
// ...
if (!$collection->existsInDatabase()) {
echo "The collection no longer exists in the database named addressbook. What happened?";
}
?>