php-doc-en/reference/mysqli/mysqli_stmt/attr-set.xml
2021-06-11 10:53:12 +03:00

137 lines
4.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqli-stmt.attr-set" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>mysqli_stmt::attr_set</refname>
<refname>mysqli_stmt_attr_set</refname>
<refpurpose>Used to modify the behavior of a prepared statement</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>&style.oop;</para>
<methodsynopsis role="oop">
<modifier>public</modifier> <type>bool</type><methodname>mysqli_stmt::attr_set</methodname>
<methodparam><type>int</type><parameter>attribute</parameter></methodparam>
<methodparam><type>int</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>&style.procedural;</para>
<methodsynopsis role="procedural">
<type>bool</type><methodname>mysqli_stmt_attr_set</methodname>
<methodparam><type>mysqli_stmt</type><parameter>statement</parameter></methodparam>
<methodparam><type>int</type><parameter>attribute</parameter></methodparam>
<methodparam><type>int</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
Used to modify the behavior of a prepared statement. This function may be
called multiple times to set several attributes.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>&mysqli.stmt.description;<varlistentry>
<term><parameter>attribute</parameter></term>
<listitem>
<para>
The attribute that you want to set. It can have one of the following values:
<table xml:id="mysqli-stmt.attr-set.parameters">
<title>Attribute values</title>
<tgroup cols="2">
<thead>
<row>
<entry>Character</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH</entry>
<entry>
Setting to &true; causes <function>mysqli_stmt_store_result</function> to
update the metadata <literal>MYSQL_FIELD-&gt;max_length</literal> value.
</entry>
</row>
<row>
<entry>MYSQLI_STMT_ATTR_CURSOR_TYPE</entry>
<entry>
Type of cursor to open for statement when <function>mysqli_stmt_execute</function>
is invoked. <parameter>value</parameter> can be <literal>MYSQLI_CURSOR_TYPE_NO_CURSOR</literal>
(the default) or <literal>MYSQLI_CURSOR_TYPE_READ_ONLY</literal>.
</entry>
</row>
<row>
<entry>MYSQLI_STMT_ATTR_PREFETCH_ROWS</entry>
<entry>
Number of rows to fetch from server at a time when using a cursor.
<parameter>value</parameter> can be in the range from 1 to the maximum
value of unsigned long. The default is 1.
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
If you use the <literal>MYSQLI_STMT_ATTR_CURSOR_TYPE</literal> option with
<literal>MYSQLI_CURSOR_TYPE_READ_ONLY</literal>, a cursor is opened for the
statement when you invoke <function>mysqli_stmt_execute</function>. If there
is already an open cursor from a previous <function>mysqli_stmt_execute</function> call,
it closes the cursor before opening a new one. <function>mysqli_stmt_reset</function>
also closes any open cursor before preparing the statement for re-execution.
<function>mysqli_stmt_free_result</function> closes any open cursor.
</para>
<para>
If you open a cursor for a prepared statement, <function>mysqli_stmt_store_result</function>
is unnecessary.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>The value to assign to the attribute.</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link xlink:href="&url.mysql.docs.stmt-attr-set;">Connector/MySQL mysql_stmt_attr_set()</link></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
-->