mirror of
https://github.com/php/pecl-database-mysql_xdevapi.git
synced 2026-03-24 15:22:07 +01:00
101 lines
2.6 KiB
XML
101 lines
2.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision: 345519 $ -->
|
|
|
|
<refentry xml:id="mysql-xdevapi-table.insert" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>Table::insert</refname>
|
|
<refpurpose>Insert table rows</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>mysql_xdevapi\TableInsert</type><methodname>mysql_xdevapi\Table::insert</methodname>
|
|
<methodparam><type>mixed</type><parameter>columns</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Inserts rows into a table.
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>columns</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The columns to insert data into. Can be an array
|
|
with one or more values, or a string.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>...</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Additional columns definitions.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
A TableInsert object; use the execute() method to execute the insert statement.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title><function>mysql_xdevapi\Table::insert</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();
|
|
$session->sql("CREATE TABLE addressbook.names(name text, age int)")->execute();
|
|
$session->sql("INSERT INTO addressbook.names values ('John', 42), ('Sam', 33)")->execute();
|
|
|
|
$schema = $session->getSchema("addressbook");
|
|
$table = $schema->getTable("names");
|
|
|
|
$table ->insert("name", "age")
|
|
->values(["Suzanne", 31],["Julie", 43])
|
|
->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
|
|
-->
|