Files
2018-08-29 13:01:54 -07:00

102 lines
2.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 345525 $ -->
<refentry xml:id="mysql-xdevapi-executable.execute" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Executable::execute</refname>
<refpurpose>Execute statement</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>abstract</modifier> <modifier>public</modifier> <type>mysql_xdevapi\Result</type><methodname>mysql_xdevapi\Executable::execute</methodname>
<void />
</methodsynopsis>
<para>
Execute the statement from either a collection operation or a table query;
this functionality allows for method chaining.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
One of the Result objects, such as Result or SqlStatementResult.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>execute() examples</title>
<programlisting role="php">
<![CDATA[
<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");
$session->sql("DROP DATABASE IF EXISTS addressbook")->execute();
$result_sql = $session->sql("CREATE DATABASE addressbook")->execute();
var_dump($result_sql);
$schema = $session->getSchema("addressbook");
$collection = $schema->createCollection("humans");
$result_collection = $collection->add(
'{"name": "Jane",
"jobs": [{"title":"Scientist","Salary":18000}, {"title":"Mother","Salary":0}],
"hobbies": ["Walking","Making pies"]}');
$result_collection_executed = $result_collection->execute();
var_dump($result_collection);
var_dump($result_collection_executed);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
object(mysql_xdevapi\SqlStatementResult)#3 (0) {
}
object(mysql_xdevapi\CollectionAdd)#5 (0) {
}
object(mysql_xdevapi\Result)#7 (0) {
}
]]>
</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
-->