mirror of
https://github.com/php/doc-ru.git
synced 2025-07-28 06:39:58 +00:00
new: mysql_xdevapi
git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@347710 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
@ -0,0 +1,132 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: 730ae1c76c5312b00b284d36fe42436e1cdbcae2 Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysql-xdevapi-collectionmodify.arrayappend" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>CollectionModify::arrayAppend</refname>
|
||||||
|
<refpurpose>Добавляет элемент в поле массива</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>mysql_xdevapi\CollectionModify</type><methodname>mysql_xdevapi\CollectionModify::arrayAppend</methodname>
|
||||||
|
<methodparam><type>string</type><parameter>collection_field</parameter></methodparam>
|
||||||
|
<methodparam><type>string</type><parameter>expression_or_literal</parameter></methodparam>
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Добавляет элемент в поле документа, когда несколько элементов поля представляются в виде массива.
|
||||||
|
В отличие от arrayInsert(), arrayAppend() всегда добавляет новый элемент
|
||||||
|
в конец массива, тогда как arrayInsert() может определять местоположение.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>collection_field</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Идентификатор поля, в которое вставляется новый элемент.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>expression_or_literal</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Новый элемент для добавления в конец массива полей документа.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Объект CollectionModify, который можно использовать для выполнения команды или для добавления дополнительных операций.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>mysql_xdevapi\CollectionModify::arrayAppend</function></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");
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->add(
|
||||||
|
'{"name": "Bernie",
|
||||||
|
"traits": ["Friend", "Brother", "Human"]}')
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$collection
|
||||||
|
->modify("name in ('Bernie', 'Jane')")
|
||||||
|
->arrayAppend('traits', 'Happy')
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->find()
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
print_r($result->fetchAll());
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
&example.outputs.similar;
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
Array
|
||||||
|
(
|
||||||
|
[0] => Array
|
||||||
|
(
|
||||||
|
[_id] => 00005b6b5361000000000000010c
|
||||||
|
[name] => Bernie
|
||||||
|
[traits] => Array
|
||||||
|
(
|
||||||
|
[0] => Friend
|
||||||
|
[1] => Brother
|
||||||
|
[2] => Human
|
||||||
|
[3] => Happy
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</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
|
||||||
|
-->
|
@ -0,0 +1,139 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: 730ae1c76c5312b00b284d36fe42436e1cdbcae2 Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysql-xdevapi-collectionmodify.arrayinsert" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>CollectionModify::arrayInsert</refname>
|
||||||
|
<refpurpose>Добавляет элемент в поле массива</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>mysql_xdevapi\CollectionModify</type><methodname>mysql_xdevapi\CollectionModify::arrayInsert</methodname>
|
||||||
|
<methodparam><type>string</type><parameter>collection_field</parameter></methodparam>
|
||||||
|
<methodparam><type>string</type><parameter>expression_or_literal</parameter></methodparam>
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Добавляет элемент в поле документа, когда несколько элементов поля представляются в виде массива.
|
||||||
|
В отличие от arrayAppend(), arrayInsert() позволяет вам указать, куда добавится новый элемент,
|
||||||
|
определяя, за каким элементом он следует, тогда как arrayAppend() всегда добавляет новый элемент в конец массива.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>collection_field</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Определите элемент в массиве, после которого добавится новый элемент.
|
||||||
|
Формат этого параметра: <literal>FIELD_NAME[ INDEX ]</literal>, где
|
||||||
|
FIELD_NAME - это имя поля документа, из которого удаляется элемент,
|
||||||
|
а INDEX - это INDEX элемента в поле.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Поле INDEX основано на нуле, поэтому самый левый элемент массива имеет индекс 0.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>expression_or_literal</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Новый элемент для добавления после FIELD_NAME[ INDEX ]
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Объект CollectionModify, который можно использовать для выполнения команды или для добавления дополнительных операций.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>mysql_xdevapi\CollectionModify::arrayInsert</function></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");
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->add(
|
||||||
|
'{"name": "Bernie",
|
||||||
|
"traits": ["Friend", "Brother", "Human"]}')
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$collection
|
||||||
|
->modify("name in ('Bernie', 'Jane')")
|
||||||
|
->arrayInsert('traits[1]', 'Happy')
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->find()
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
print_r($result->fetchAll());
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
&example.outputs.similar;
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
Array
|
||||||
|
(
|
||||||
|
[0] => Array
|
||||||
|
(
|
||||||
|
[_id] => 00005b6b5361000000000000010d
|
||||||
|
[name] => Bernie
|
||||||
|
[traits] => Array
|
||||||
|
(
|
||||||
|
[0] => Friend
|
||||||
|
[1] => Happy
|
||||||
|
[2] => Brother
|
||||||
|
[3] => Human
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</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
|
||||||
|
-->
|
129
reference/mysql_xdevapi/mysql_xdevapi/collectionmodify/bind.xml
Normal file
129
reference/mysql_xdevapi/mysql_xdevapi/collectionmodify/bind.xml
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: 730ae1c76c5312b00b284d36fe42436e1cdbcae2 Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysql-xdevapi-collectionmodify.bind" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>CollectionModify::bind</refname>
|
||||||
|
<refpurpose>Привязывает значение к заполнителю запроса</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>mysql_xdevapi\CollectionModify</type><methodname>mysql_xdevapi\CollectionModify::bind</methodname>
|
||||||
|
<methodparam><type>array</type><parameter>placeholder_values</parameter></methodparam>
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Привязывает параметр к заполнителю в условии поиска операции изменения.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Заполнитель имеет вид :NAME, где ':' - это общий префикс, который должен всегда существовать до любого NAME,
|
||||||
|
где NAME - это имя заполнителя. Метод bind принимает список заполнителей, если в условии поиска операции изменения
|
||||||
|
необходимо заменить несколько объектов.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>placeholder_values</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Подстановочные значения для замены в условии поиска. Допускается использование нескольких значений,
|
||||||
|
которые необходимо передать в виде массива сопоставлений PLACEHOLDER_NAME->PLACEHOLDER_VALUE.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Объект CollectionModify, который можно использовать для выполнения команды или для добавления дополнительных операций.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>mysql_xdevapi\CollectionModify::bind</function></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");
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->add(
|
||||||
|
'{"name": "Bernie",
|
||||||
|
"traits": ["Friend", "Brother", "Human"]}')
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$collection
|
||||||
|
->modify("name = :name")
|
||||||
|
->bind(['name' => 'Bernie'])
|
||||||
|
->arrayAppend('traits', 'Happy')
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->find()
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
print_r($result->fetchAll());
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
&example.outputs.similar;
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
Array
|
||||||
|
(
|
||||||
|
[0] => Array
|
||||||
|
(
|
||||||
|
[_id] => 00005b6b53610000000000000110
|
||||||
|
[name] => Bernie
|
||||||
|
[traits] => Array
|
||||||
|
(
|
||||||
|
[0] => Friend
|
||||||
|
[1] => Brother
|
||||||
|
[2] => Human
|
||||||
|
[3] => Happy
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</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
|
||||||
|
-->
|
@ -0,0 +1,106 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: 730ae1c76c5312b00b284d36fe42436e1cdbcae2 Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysql-xdevapi-collectionmodify.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>CollectionModify::__construct</refname>
|
||||||
|
<refpurpose>Конструктор класса CollectionModify</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<constructorsynopsis>
|
||||||
|
<modifier>private</modifier> <methodname>mysql_xdevapi\CollectionModify::__construct</methodname>
|
||||||
|
<void />
|
||||||
|
</constructorsynopsis>
|
||||||
|
<para>
|
||||||
|
Ищменяет (обновляет) коллекцию
|
||||||
|
и создается методом Collection::modify().
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
&no.function.parameters;
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>mysql_xdevapi\CollectionModify::__construct</function></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");
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->add(
|
||||||
|
'{"name": "Bernie",
|
||||||
|
"traits": ["Friend", "Brother", "Human"]}')
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$collection
|
||||||
|
->modify("name in ('Bernie', 'Jane')")
|
||||||
|
->arrayAppend('traits', 'Happy')
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->find()
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
print_r($result->fetchAll());
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
&example.outputs.similar;
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
Array
|
||||||
|
(
|
||||||
|
[0] => Array
|
||||||
|
(
|
||||||
|
[_id] => 00005b6b5361000000000000010c
|
||||||
|
[name] => Bernie
|
||||||
|
[traits] => Array
|
||||||
|
(
|
||||||
|
[0] => Friend
|
||||||
|
[1] => Brother
|
||||||
|
[2] => Human
|
||||||
|
[3] => Happy
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</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
|
||||||
|
-->
|
@ -0,0 +1,76 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: 730ae1c76c5312b00b284d36fe42436e1cdbcae2 Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysql-xdevapi-collectionmodify.execute" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>CollectionModify::execute</refname>
|
||||||
|
<refpurpose>Выполняет операцию изменения</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>mysql_xdevapi\Result</type><methodname>mysql_xdevapi\CollectionModify::execute</methodname>
|
||||||
|
<void />
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Метод execute необходим для отправки запроса операции CRUD
|
||||||
|
на сервер MySQL.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
&no.function.parameters;
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Объект Result, который можно использовать для проверки состояния операции,
|
||||||
|
например, количества затронутых строк.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>mysql_xdevapi\CollectionModify::execute</function></title>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/* ... */
|
||||||
|
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</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
|
||||||
|
-->
|
131
reference/mysql_xdevapi/mysql_xdevapi/collectionmodify/limit.xml
Normal file
131
reference/mysql_xdevapi/mysql_xdevapi/collectionmodify/limit.xml
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: 18f9cbcbc404fa3161104e4f3969531f686457af Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysql-xdevapi-collectionmodify.limit" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>CollectionModify::limit</refname>
|
||||||
|
<refpurpose>Ограничивает количество изменяемых документов</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>mysql_xdevapi\CollectionModify</type><methodname>mysql_xdevapi\CollectionModify::limit</methodname>
|
||||||
|
<methodparam><type>integer</type><parameter>rows</parameter></methodparam>
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Ограничивает количество документов, изменяемых этой операцией.
|
||||||
|
При желании можно использовать skip() для определения значения смещения.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>rows</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Максимальное количество документов для изменения.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Объект CollectionModify.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>mysql_xdevapi\CollectionModify::limit</function></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": "Fred", "age": 21, "job": "Construction"}')->execute();
|
||||||
|
$collection->add('{"name": "Wilma", "age": 23, "job": "Teacher"}')->execute();
|
||||||
|
$collection->add('{"name": "Betty", "age": 24, "job": "Teacher"}')->execute();
|
||||||
|
|
||||||
|
$collection
|
||||||
|
->modify("job = :job")
|
||||||
|
->bind(['job' => 'Teacher'])
|
||||||
|
->set('job', 'Principal')
|
||||||
|
->limit(1)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->find()
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
print_r($result->fetchAll());
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
&example.outputs.similar;
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
Array
|
||||||
|
(
|
||||||
|
[0] => Array
|
||||||
|
(
|
||||||
|
[_id] => 00005b6b53610000000000000118
|
||||||
|
[age] => 21
|
||||||
|
[job] => Construction
|
||||||
|
[name] => Fred
|
||||||
|
)
|
||||||
|
[1] => Array
|
||||||
|
(
|
||||||
|
[_id] => 00005b6b53610000000000000119
|
||||||
|
[age] => 23
|
||||||
|
[job] => Principal
|
||||||
|
[name] => Wilma
|
||||||
|
)
|
||||||
|
[2] => Array
|
||||||
|
(
|
||||||
|
[_id] => 00005b6b5361000000000000011a
|
||||||
|
[age] => 24
|
||||||
|
[job] => Teacher
|
||||||
|
[name] => Betty
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</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
|
||||||
|
-->
|
@ -0,0 +1,86 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: 18f9cbcbc404fa3161104e4f3969531f686457af Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysql-xdevapi-collectionmodify.patch" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>CollectionModify::patch</refname>
|
||||||
|
<refpurpose>Исправляет документ</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>mysql_xdevapi\CollectionModify</type><methodname>mysql_xdevapi\CollectionModify::patch</methodname>
|
||||||
|
<methodparam><type>string</type><parameter>document</parameter></methodparam>
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Принимает объект исправления и применяет его к одному или нескольким документам
|
||||||
|
и может обновлять несколько свойств документа.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
&warn.undocumented.func;
|
||||||
|
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>document</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Документ со свойствами, применяемыми к соответствующим документам.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Объект CollectionModify.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>mysql_xdevapi\CollectionModify::patch</function></title>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$res = $coll->modify('"Programmatore" IN job')->patch('{"Hobby" : "Programmare"}')->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
|
||||||
|
-->
|
@ -0,0 +1,130 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: 18f9cbcbc404fa3161104e4f3969531f686457af Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysql-xdevapi-collectionmodify.replace" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>CollectionModify::replace</refname>
|
||||||
|
<refpurpose>Заменяет поле документа</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>mysql_xdevapi\CollectionModify</type><methodname>mysql_xdevapi\CollectionModify::replace</methodname>
|
||||||
|
<methodparam><type>string</type><parameter>collection_field</parameter></methodparam>
|
||||||
|
<methodparam><type>string</type><parameter>expression_or_literal</parameter></methodparam>
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Заменяет (обновляет) данное значение поля новым.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>collection_field</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Путь документа к элементу для обновления.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>expression_or_literal</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Значение, устанавливаемое для указанного атрибута.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Объект CollectionModify.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>mysql_xdevapi\CollectionModify::replace</function></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");
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->add(
|
||||||
|
'{"name": "Bernie",
|
||||||
|
"traits": ["Friend", "Brother", "Human"]}')
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$collection
|
||||||
|
->modify("name = :name")
|
||||||
|
->bind(['name' => 'Bernie'])
|
||||||
|
->replace("name", "Bern")
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->find()
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
print_r($result->fetchAll());
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
&example.outputs.similar;
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
Array
|
||||||
|
(
|
||||||
|
[0] => Array
|
||||||
|
(
|
||||||
|
[_id] => 00005b6b5361000000000000011b
|
||||||
|
[name] => Bern
|
||||||
|
[traits] => Array
|
||||||
|
(
|
||||||
|
[0] => Friend
|
||||||
|
[1] => Brother
|
||||||
|
[2] => Human
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</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
|
||||||
|
-->
|
130
reference/mysql_xdevapi/mysql_xdevapi/collectionmodify/set.xml
Normal file
130
reference/mysql_xdevapi/mysql_xdevapi/collectionmodify/set.xml
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: 18f9cbcbc404fa3161104e4f3969531f686457af Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysql-xdevapi-collectionmodify.set" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>CollectionModify::set</refname>
|
||||||
|
<refpurpose>Устанавливает атрибут документа</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>mysql_xdevapi\CollectionModify</type><methodname>mysql_xdevapi\CollectionModify::set</methodname>
|
||||||
|
<methodparam><type>string</type><parameter>collection_field</parameter></methodparam>
|
||||||
|
<methodparam><type>string</type><parameter>expression_or_literal</parameter></methodparam>
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Устанавливает или обновляет атрибуты документов в коллекции.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>collection_field</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Путь к документу (имя) элемента для установки.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>expression_or_literal</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Значение для установки.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Объект CollectionModify.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>mysql_xdevapi\CollectionModify::set</function></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");
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->add(
|
||||||
|
'{"name": "Bernie",
|
||||||
|
"traits": ["Friend", "Brother", "Human"]}')
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$collection
|
||||||
|
->modify("name = :name")
|
||||||
|
->bind(['name' => 'Bernie'])
|
||||||
|
->set("name", "Bern")
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$result = $collection
|
||||||
|
->find()
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
print_r($result->fetchAll());
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
&example.outputs.similar;
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
Array
|
||||||
|
(
|
||||||
|
[0] => Array
|
||||||
|
(
|
||||||
|
[_id] => 00005b6b53610000000000000111
|
||||||
|
[name] => Bern
|
||||||
|
[traits] => Array
|
||||||
|
(
|
||||||
|
[0] => Friend
|
||||||
|
[1] => Brother
|
||||||
|
[2] => Human
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</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
|
||||||
|
-->
|
@ -0,0 +1,87 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: 18f9cbcbc404fa3161104e4f3969531f686457af Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysql-xdevapi-collectionmodify.skip" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>CollectionModify::skip</refname>
|
||||||
|
<refpurpose>Пропускает элементы</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>mysql_xdevapi\CollectionModify</type><methodname>mysql_xdevapi\CollectionModify::skip</methodname>
|
||||||
|
<methodparam><type>integer</type><parameter>position</parameter></methodparam>
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Пропускает первые N элементов, которые в противном случае были бы возвращены операцией поиска.
|
||||||
|
Если количество пропущенных элементов превышает размер набора результатов,
|
||||||
|
операция поиска возвращает пустой набор.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
&warn.undocumented.func;
|
||||||
|
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>position</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Количество пропускаемых элементов.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Объект CollectionModify, который можно использовать для дальнейшей обработки.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>mysql_xdevapi\CollectionModify::skip</function></title>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$coll->modify('age > :age')->sort('age desc')->unset(['age'])->bind(['age' => 20])->limit(4)->skip(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
|
||||||
|
-->
|
@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: 18f9cbcbc404fa3161104e4f3969531f686457af Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysql-xdevapi-collectionmodify.sort" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>CollectionModify::sort</refname>
|
||||||
|
<refpurpose>Устанавливает критерии сортировки</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>mysql_xdevapi\CollectionModify</type><methodname>mysql_xdevapi\CollectionModify::sort</methodname>
|
||||||
|
<methodparam><type>string</type><parameter>sort_expr</parameter></methodparam>
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Сортирует набор результатов по полю, выбранному в аргументе sort_expr. Разрешенные
|
||||||
|
направления: ASC (по возрастанию) или DESC (по убыванию). Эта операция эквивалентна операции SQL 'ORDER BY'
|
||||||
|
и соответствует тому же набору правил.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
&warn.undocumented.func;
|
||||||
|
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>sort_expr</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Можно указать одно или несколько выражений сортировки, Применяется слева направо,
|
||||||
|
каждое выражение должно быть разделено запятой.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Объект CollectionModify, который можно использовать для дальнейшей обработки.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>mysql_xdevapi\CollectionModify::sort</function></title>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$res = $coll->modify('true')->sort('name desc', 'age asc')->limit(4)->set('Married', 'NO')->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
|
||||||
|
-->
|
@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: 18f9cbcbc404fa3161104e4f3969531f686457af Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysql-xdevapi-collectionmodify.unset" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>CollectionModify::unset</refname>
|
||||||
|
<refpurpose>Сбрасывает значение полей документа</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>mysql_xdevapi\CollectionModify</type><methodname>mysql_xdevapi\CollectionModify::unset</methodname>
|
||||||
|
<methodparam><type>array</type><parameter>fields</parameter></methodparam>
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Удаляет атрибуты из документов в коллекции.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
&warn.undocumented.func;
|
||||||
|
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>fields</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Атрибуты для удаления из документов в коллекции.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Объект CollectionModify, который можно использовать для дальнейшей обработки.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>mysql_xdevapi\CollectionModify::unset</function></title>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$res = $coll->modify('job like :job_name')->unset(["age", "name"])->bind(['job_name' => 'Plumber'])->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
|
||||||
|
-->
|
@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: d8b968e63cba67a082e6e37aee1ebe7821b41258 Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysqlnduhpreparedstatement.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>MysqlndUhPreparedStatement::__construct</refname>
|
||||||
|
<refpurpose>Результат __construct</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <methodname>MysqlndUhPreparedStatement::__construct</methodname>
|
||||||
|
<void />
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
&warn.undocumented.func;
|
||||||
|
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
&no.function.parameters;
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
</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
|
||||||
|
-->
|
128
reference/mysqlnd_uh/mysqlnduhpreparedstatement/execute.xml
Normal file
128
reference/mysqlnd_uh/mysqlnduhpreparedstatement/execute.xml
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: ed710737ea7ce93f1289809cf89170c6d48b72a6 Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysqlnduhpreparedstatement.execute" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>MysqlndUhPreparedStatement::execute</refname>
|
||||||
|
<refpurpose>Выполняет подготовленный запрос</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhPreparedStatement::execute</methodname>
|
||||||
|
<methodparam><type>mysqlnd_prepared_statement</type><parameter>statement</parameter></methodparam>
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Выполняет подготовленный запрос.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>statement</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Подготовленный Mysqlnd оператор дескриптора. Не изменяйте его!
|
||||||
|
Ресурс типа <literal>Mysqlnd Prepared Statement (internal only - you must not modify it!)</literal>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Возвращает &true; в случае успешного выполнения.
|
||||||
|
В противном случае возвращает &false;
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<para>
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>MysqlndUhPreparedStatement::execute</function></title>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
class stmt_proxy extends MysqlndUhPreparedStatement {
|
||||||
|
public function execute($res) {
|
||||||
|
printf("%s(", __METHOD__);
|
||||||
|
var_dump($res);
|
||||||
|
printf(")\n");
|
||||||
|
$ret = parent::execute($res);
|
||||||
|
printf("%s returns %s\n", __METHOD__, var_export($ret, true));
|
||||||
|
var_dump($ret);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mysqlnd_uh_set_statement_proxy(new stmt_proxy());
|
||||||
|
|
||||||
|
$mysqli = new mysqli("localhost", "root", "", "test");
|
||||||
|
$stmt = $mysqli->prepare("SELECT 'Labskaus' AS _msg FROM DUAL");
|
||||||
|
$stmt->execute();
|
||||||
|
$msg = NULL;
|
||||||
|
$stmt->bind_result($msg);
|
||||||
|
$stmt->fetch();
|
||||||
|
var_dump($msg);
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
&example.outputs;
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
stmt_proxy::execute(resource(256) of type (Mysqlnd Prepared Statement (internal only - you must not modify it!))
|
||||||
|
)
|
||||||
|
stmt_proxy::execute returns true
|
||||||
|
bool(true)
|
||||||
|
string(8) "Labskaus"
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</example>
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="seealso">
|
||||||
|
&reftitle.seealso;
|
||||||
|
<para>
|
||||||
|
<simplelist>
|
||||||
|
<member>
|
||||||
|
<function>mysqlnd_uh_set_statement_proxy</function>
|
||||||
|
</member>
|
||||||
|
<member>
|
||||||
|
<function>mysqli_stmt_execute</function>
|
||||||
|
</member>
|
||||||
|
</simplelist>
|
||||||
|
</para>
|
||||||
|
</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
|
||||||
|
-->
|
139
reference/mysqlnd_uh/mysqlnduhpreparedstatement/prepare.xml
Normal file
139
reference/mysqlnd_uh/mysqlnduhpreparedstatement/prepare.xml
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<!-- EN-Revision: ed710737ea7ce93f1289809cf89170c6d48b72a6 Maintainer: sergey Status: ready -->
|
||||||
|
<!-- Reviewed: no -->
|
||||||
|
|
||||||
|
<refentry xml:id="mysqlnduhpreparedstatement.prepare" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<refnamediv>
|
||||||
|
<refname>MysqlndUhPreparedStatement::prepare</refname>
|
||||||
|
<refpurpose>Подготавливает утверждение SQL для выполнения</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
|
<refsect1 role="description">
|
||||||
|
&reftitle.description;
|
||||||
|
<methodsynopsis>
|
||||||
|
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhPreparedStatement::prepare</methodname>
|
||||||
|
<methodparam><type>mysqlnd_prepared_statement</type><parameter>statement</parameter></methodparam>
|
||||||
|
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||||
|
</methodsynopsis>
|
||||||
|
<para>
|
||||||
|
Подготавливает утверждение SQL для выполнения.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="parameters">
|
||||||
|
&reftitle.parameters;
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>statement</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Подготовленный Mysqlnd оператор дескриптора. Не изменяйте его!
|
||||||
|
Ресурс типа <literal>Mysqlnd Prepared Statement (internal only - you must not modify it!)</literal>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>query</parameter></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Запрос, который должен быть подготовлен.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="returnvalues">
|
||||||
|
&reftitle.returnvalues;
|
||||||
|
<para>
|
||||||
|
Возвращает &true; в случае успешного выполнения.
|
||||||
|
В противном случае возвращает &false;
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="examples">
|
||||||
|
&reftitle.examples;
|
||||||
|
<para>
|
||||||
|
<example>
|
||||||
|
<title>Пример использования <function>MysqlndUhPreparedStatement::prepare</function></title>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
class stmt_proxy extends MysqlndUhPreparedStatement {
|
||||||
|
public function prepare($res, $query) {
|
||||||
|
printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
|
||||||
|
$query = "SELECT 'No more you-know-what-I-mean for lunch, please' AS _msg FROM DUAL";
|
||||||
|
$ret = parent::prepare($res, $query);
|
||||||
|
printf("%s returns %s\n", __METHOD__, var_export($ret, true));
|
||||||
|
var_dump($ret);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mysqlnd_uh_set_statement_proxy(new stmt_proxy());
|
||||||
|
|
||||||
|
$mysqli = new mysqli("localhost", "root", "", "test");
|
||||||
|
$stmt = $mysqli->prepare("SELECT 'Labskaus' AS _msg FROM DUAL");
|
||||||
|
$stmt->execute();
|
||||||
|
$msg = NULL;
|
||||||
|
$stmt->bind_result($msg);
|
||||||
|
$stmt->fetch();
|
||||||
|
var_dump($msg);
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
&example.outputs;
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
stmt_proxy::prepare(array (
|
||||||
|
0 => NULL,
|
||||||
|
1 => 'SELECT \'Labskaus\' AS _msg FROM DUAL',
|
||||||
|
))
|
||||||
|
stmt_proxy::prepare returns true
|
||||||
|
bool(true)
|
||||||
|
string(46) "No more you-know-what-I-mean for lunch, please"
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</example>
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 role="seealso">
|
||||||
|
&reftitle.seealso;
|
||||||
|
<para>
|
||||||
|
<simplelist>
|
||||||
|
<member>
|
||||||
|
<function>mysqlnd_uh_set_statement_proxy</function>
|
||||||
|
</member>
|
||||||
|
<member>
|
||||||
|
<function>mysqli_stmt_prepare</function>
|
||||||
|
</member>
|
||||||
|
<member>
|
||||||
|
<function>mysqli_prepare</function>
|
||||||
|
</member>
|
||||||
|
</simplelist>
|
||||||
|
</para>
|
||||||
|
</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
|
||||||
|
-->
|
Reference in New Issue
Block a user