mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Added pg_fetch_all(), pg_fetch_assoc(), pg_result_seek() and pg_unescape_byptea() desc.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@97686 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
0f8ae6def9
commit
b0085f3057
4 changed files with 278 additions and 0 deletions
76
reference/pgsql/functions/pg-fetch-all.xml
Normal file
76
reference/pgsql/functions/pg-fetch-all.xml
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.pg-fetch-all">
|
||||
<refnamediv>
|
||||
<refname>pg_fetch_all</refname>
|
||||
<refpurpose>Fetch a row as an array</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>pg_fetch_all</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_fetch_all</function> returns an array that
|
||||
contains all row (tuples/records) in result resource. It returns
|
||||
&false;, if there are no more rows.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>pg_fetch_row</function>,
|
||||
<function>pg_fetch_array</function>,
|
||||
<function>pg_fetch_object</function> and
|
||||
<function>pg_fetch_result</function>.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>PostgreSQL fetch array</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$conn = pg_pconnect ("dbname=publisher");
|
||||
if (!$conn) {
|
||||
echo "An error occured.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = pg_query ($conn, "SELECT * FROM authors");
|
||||
if (!$result) {
|
||||
echo "An error occured.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$arr = pg_fetch_all ($result, 0, PGSQL_NUM);
|
||||
|
||||
var_dump($arr);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</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:"../../../../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
|
||||
-->
|
90
reference/pgsql/functions/pg-fetch-assoc.xml
Normal file
90
reference/pgsql/functions/pg-fetch-assoc.xml
Normal file
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.pg-fetch-assoc">
|
||||
<refnamediv>
|
||||
<refname>pg_fetch_assoc</refname>
|
||||
<refpurpose>Fetch a row as an array</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>pg_fetch_assoc</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_fetch_assoc</function> returns an associative array that
|
||||
corresponds to the fetched row (tuples/records). It returns
|
||||
&false;, if there are no more rows.
|
||||
</para>
|
||||
<para>
|
||||
<function>pg_fetch_assoc</function> is an extended version of
|
||||
<function>pg_fetch_row</function>. In addition to storing the
|
||||
data in the numeric indices (field index) to the result array, it
|
||||
also stores the data in associative indices (field name) by
|
||||
default.
|
||||
</para>
|
||||
<para>
|
||||
<parameter>row</parameter> is row (record) number to be
|
||||
retrieved. First row is 0.
|
||||
</para>
|
||||
<para>
|
||||
<function>pg_fetch_assoc</function> is NOT significantly
|
||||
slower than using <function>pg_fetch_row</function>, while it
|
||||
provides a significant ease of use.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>pg_fetch_row</function>,
|
||||
<function>pg_fetch_array</function>,
|
||||
<function>pg_fetch_object</function> and
|
||||
<function>pg_fetch_result</function>.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>PostgreSQL fetch array</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$conn = pg_pconnect ("dbname=publisher");
|
||||
if (!$conn) {
|
||||
echo "An error occured.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = pg_query ($conn, "SELECT * FROM authors");
|
||||
if (!$result) {
|
||||
echo "An error occured.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$arr = pg_fetch_assoc ($result, 1, PGSQL_ASSOC);
|
||||
echo $arr["author"] . " <- array\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</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:"../../../../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
|
||||
-->
|
49
reference/pgsql/functions/pg-result-seek.xml
Normal file
49
reference/pgsql/functions/pg-result-seek.xml
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.pg-result-seek">
|
||||
<refnamediv>
|
||||
<refname>pg_result_seek</refname>
|
||||
<refpurpose>Set internal row offset in result resource</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>pg_result_seek</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>offset</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_result_seek</function> set internal row offset in
|
||||
reuslt resource. It returns &false;, if there is error.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>pg_fetch_row</function>,
|
||||
<function>pg_fetch_assoc</function>,
|
||||
<function>pg_fetch_array</function>,
|
||||
<function>pg_fetch_object</function> and
|
||||
<function>pg_fetch_result</function>.
|
||||
</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:"../../../../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
|
||||
-->
|
63
reference/pgsql/functions/pg-unescape-bytea.xml
Normal file
63
reference/pgsql/functions/pg-unescape-bytea.xml
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.61 -->
|
||||
<refentry id='function.pg-unescape-bytea'>
|
||||
<refnamediv>
|
||||
<refname>pg_unescape_bytea</refname>
|
||||
<refpurpose>
|
||||
Escape binary for bytea type
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>pg_unescape_bytea</methodname>
|
||||
<methodparam><type>string</type><parameter>data</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_unescape_bytea</function> unescapes string from
|
||||
bytea datatype. It returns unescaped string (binary).
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
When you SELECT bytea type, PostgreSQL returns octal byte value
|
||||
prefixed by \ (e.g. \032). Users are supposed to convert back to
|
||||
binary format by yourself.
|
||||
</para>
|
||||
<para>
|
||||
This function requires PostgreSQL 7.2 or later. With PostgreSQL
|
||||
7.2.0 and 7.2.1, bytea type must be casted when you enable
|
||||
multi-byte support. i.e. <literal>INSERT INTO test_table (image)
|
||||
VALUES ('$image_escaped'::bytea);</literal> PostgreSQL 7.2.2 or
|
||||
later does not need cast. Exception is when client and backend
|
||||
character encoding does not match, there may be multi-byte
|
||||
stream error. User must cast to bytea to avoid this error.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
See also <function>pg_escape_bytea</function> and
|
||||
<function>pg_escape_string</function>
|
||||
</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:"../../../../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
|
||||
-->
|
Loading…
Reference in a new issue