mirror of
https://github.com/php/pecl-database-mysql_xdevapi.git
synced 2026-03-26 08:12:17 +01:00
91 lines
2.2 KiB
XML
91 lines
2.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision: 345561 $ -->
|
|
|
|
<refentry xml:id="mysql-xdevapi-collectionremove.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>CollectionRemove::__construct</refname>
|
|
<refpurpose>CollectionRemove constructor</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<constructorsynopsis>
|
|
<modifier>private</modifier> <methodname>mysql_xdevapi\CollectionRemove::__construct</methodname>
|
|
<void />
|
|
</constructorsynopsis>
|
|
<para>
|
|
Remove collection documents,
|
|
and is instantiated by the Collection::remove() method.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
&no.function.parameters;
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title><function>mysql_xdevapi\Collection::remove</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?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");
|
|
$collection = $schema->createCollection("people");
|
|
|
|
$collection->add('{"name": "Alfred", "age": 18, "job": "Butler"}')->execute();
|
|
$collection->add('{"name": "Bob", "age": 19, "job": "Painter"}')->execute();
|
|
|
|
// Remove all painters
|
|
$collection
|
|
->remove("job in ('Painter')")
|
|
->execute();
|
|
|
|
// Remove the oldest butler
|
|
$collection
|
|
->remove("job in ('Butler')")
|
|
->sort('age desc')
|
|
->limit(1)
|
|
->execute();
|
|
|
|
// Remove record with lowest age
|
|
$collection
|
|
->remove('true')
|
|
->sort('age desc')
|
|
->limit(1)
|
|
->execute();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|