Files
php-doc-ru/reference/mysqli/mysqli_stmt/data-seek.xml
2023-01-28 09:24:03 +03:00

158 lines
4.5 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 51c34024efa35d5691825b3e61037ffe61c46d20 Maintainer: tmn Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="mysqli-stmt.data-seek" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mysqli_stmt::data_seek</refname>
<refname>mysqli_stmt_data_seek</refname>
<refpurpose>Корректирует указатель результата на произвольную строку в буферизованном результате</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>&style.oop;</para>
<methodsynopsis role="mysqli_stmt">
<modifier>public</modifier> <type>void</type><methodname>mysqli_stmt::data_seek</methodname>
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>&style.procedural;</para>
<methodsynopsis>
<type>void</type><methodname>mysqli_stmt_data_seek</methodname>
<methodparam><type>mysqli_stmt</type><parameter>statement</parameter></methodparam>
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>
Функция перемещает указатель буферизованного набора результатов в произвольную строку,
заданную параметром <parameter>offset</parameter>.
</para>
<para>
Функция работает только с буферизованным внутренним набором результатов.
Функция <function>mysqli_stmt_store_result</function> должна быть вызвана до
<function>mysqli_stmt_data_seek</function>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&mysqli.stmt.description;
<varlistentry>
<term><parameter>offset</parameter></term>
<listitem>
<para>
Значение должно быть в диапазоне от 0 до числа строк минус один (0..
<function>mysqli_stmt_num_rows</function> - 1).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>&style.oop;</title>
<programlisting role="php">
<![CDATA[
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
$stmt = $mysqli->prepare($query);
$stmt->execute();
$stmt->bind_result($name, $code);
$stmt->store_result();
/* переходим к строке 400 результирующей таблицы */
$stmt->data_seek(399);
$stmt->fetch();
printf("Город: %s Код страны: %s\n", $name, $code);
?>
]]>
</programlisting>
</example>
<example>
<title>&style.procedural;</title>
<programlisting role="php">
<![CDATA[
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
$stmt = mysqli_prepare($link, $query);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $name, $code);
mysqli_stmt_store_result($stmt);
/* переходим к строке 400 результирующей таблицы */
mysqli_stmt_data_seek($stmt, 399);
mysqli_stmt_fetch($stmt);
printf("Город: %s Код страны: %s\n", $name, $code);
?>
]]>
</programlisting>
&examples.outputs;
<screen>
<![CDATA[
Город: Benin City Код страны: NGA
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mysqli_prepare</function></member>
<member><function>mysqli_stmt_store_result</function></member>
<member><function>mysqli_stmt_num_rows</function></member>
<member><function>mysqli_data_seek</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
-->