PHP 8.4.0 RC4 available for testing

Schema::getCollection

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

Schema::getCollectionGet collection from schema

Опис

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

Get a collection from the schema.

Параметри

name

Collection name to retrieve.

Значення, що повертаються

The Collection object for the selected collection.

Приклади

Приклад #1 mysql_xdevapi\Schema::getCollection() example

<?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"
}
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top