mirror of
https://github.com/php/doc-it.git
synced 2026-03-25 08:02:09 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@314554 c90b9560-bf6c-de11-be94-00142212c4b1
121 lines
3.9 KiB
XML
121 lines
3.9 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- splitted from ./it/functions/pgsql.xml, last change in rev 1.10 -->
|
|
<!-- last change to 'pg-fetch-array' in en/ tree in rev 1.2 -->
|
|
<!-- EN-Revision: n/a Maintainer: cucinato Status: ready -->
|
|
<!-- OLD-Revision: 1.70/EN.1.2 -->
|
|
<!-- CREDITS: fabio,cortesi,denny -->
|
|
<refentry xml:id="function.pg-fetch-array" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_fetch_array</refname>
|
|
<refpurpose>Carica una tupla in un array</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descrizione</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>pg_fetch_array</methodname>
|
|
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>tupla</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>tipo_risultato</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>pg_fetch_array</function> restituisce un array che
|
|
corrisponde alla riga caricata (tuple/record). Restituisce
|
|
&false; se non ci sono più righe.
|
|
</para>
|
|
<para>
|
|
<function>pg_fetch_array</function> è una versione estesa di
|
|
<function>pg_fetch_row</function>. Oltre a salvare i
|
|
dati in un array con indici numerici,
|
|
li salva pure in un array associativo, utilizzando i nomi dei campi
|
|
come chiave.
|
|
</para>
|
|
<para>
|
|
<parameter>tupla</parameter> è il numero della riga (record) che deve
|
|
essere caricata. La prima riga è la 0.
|
|
</para>
|
|
<para>
|
|
<parameter>tipo_risultato</parameter> è un parametro opzionale che controlla
|
|
come il risultato viene restituito.
|
|
<parameter>result_type</parameter> è una costante e può assumere i
|
|
seguenti valori: <constant>PGSQL_ASSOC</constant>,
|
|
<constant>PGSQL_NUM</constant>, e <constant>PGSQL_BOTH</constant>.
|
|
<function>pg_fetch_array</function> restituisce un array associativo
|
|
con il nome del campo come chiave con <constant>PGSQL_ASSOC</constant>, oppure l'indice del campo
|
|
con <constant>PGSQL_NUM</constant> o entrambi con
|
|
<constant>PGSQL_BOTH</constant>. Il default è <constant>PGSQL_BOTH</constant>.
|
|
<note>
|
|
<para>
|
|
<parameter>tipo_risultato</parameter> è stato aggiunto nel PHP 4.0.
|
|
</para>
|
|
</note>
|
|
</para>
|
|
<para>
|
|
<function>pg_fetch_array</function> NON è più
|
|
lento di <function>pg_fetch_row</function>, inoltre
|
|
è più facile da usare.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>PostgreSQL fetch array</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$conn = pg_pconnect ("dbname=editori");
|
|
if (!$conn) {
|
|
echo "Si è verificato un errore.\n";
|
|
exit;
|
|
}
|
|
|
|
$risultato = pg_query ($conn, "SELECT * FROM autori");
|
|
if (!$risultato) {
|
|
echo "Si è verificato un errore.\n";
|
|
exit;
|
|
}
|
|
|
|
$arr = pg_fetch_array ($risultato, 0, PGSQL_NUM);
|
|
echo $arr[0] . " <- array\n";
|
|
|
|
$arr = pg_fetch_array ($risultato, 1, PGSQL_ASSOC);
|
|
echo $arr["autore"] . " <- array\n";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Vedere anche
|
|
<function>pg_fetch_row</function>,
|
|
<function>pg_fetch_object</function> e
|
|
<function>pg_fetch_result</function>.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Dalla versione 4.1.0, <parameter>tupla</parameter> è opzionale.
|
|
La chiamata a <function>pg_fetch_array</function> incrementa
|
|
di 1 il puntatore alle tuple.
|
|
</para>
|
|
</note>
|
|
</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
|
|
-->
|