mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-26 18:02:17 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@300147 c90b9560-bf6c-de11-be94-00142212c4b1
151 lines
4.4 KiB
XML
151 lines
4.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 0640e024d4b8a9400d457143ccd0ea66e5f98ead Maintainer: jsgoupil Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
|
|
<refentry xml:id="function.pg-convert" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_convert</refname>
|
|
<refpurpose>
|
|
Convertit des tableaux associatifs en une commande PostgreSQL
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>pg_convert</methodname>
|
|
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>assoc_array</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>0</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>pg_convert</function> vérifie et convertit le tableau
|
|
associatif <parameter>assoc_array</parameter> en une requête SQL valide.
|
|
Pour que <function>pg_convert</function> fonctionne, il faut que la table
|
|
<parameter>table_name</parameter> existe, et contienne au moins autant de colonnes
|
|
que le tableau <parameter>assoc_array</parameter> a d'éléments. Les noms des
|
|
champs de <parameter>table_name</parameter> doivent correspondre aux index
|
|
du tableau dans <parameter>assoc_array</parameter>.
|
|
Retourne un tableau avec les valeurs converties en cas de succès, et sinon,
|
|
&false;.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
S'il y a des champs booléens dans <parameter>table_name</parameter>,
|
|
n'utilisez pas la constante &true; dans
|
|
<parameter>assoc_array</parameter>. Elle sera convertie en chaîne de
|
|
caractères <literal>"TRUE"</literal> qui ne sera pas une entrée valide pour un champ booléen
|
|
en PostgreSQL. Utilisez une de ces valeurs à la place : <literal>"t"</literal>,
|
|
<literal>"true"</literal>, <literal>"1"</literal>, <literal>"y"</literal>,
|
|
<literal>"yes"</literal>.
|
|
</para>
|
|
</note>
|
|
&warn.experimental.func;
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>connection</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Ressource de connexion de base de données PostgreSQL.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>table_name</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Nom de la table sur pour laquelle les types seront convertis.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>assoc_array</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Données à être converties.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>options</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Un nombre de <constant>PGSQL_CONV_IGNORE_DEFAULT</constant>,
|
|
<constant>PGSQL_CONV_FORCE_NULL</constant> ou
|
|
<constant>PGSQL_CONV_IGNORE_NOT_NULL</constant>, combiné.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Un tableau des valeurs converties ou &false; en cas d'erreur.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>pg_convert</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$dbconn = pg_connect('dbname=foo');
|
|
|
|
$tmp = array(
|
|
'auteur' => 'Joe Thackery',
|
|
'annee' => 2005,
|
|
'titre' => 'Ma Vie, par Joe Thackery'
|
|
);
|
|
|
|
$vals = pg_convert($dbconn, 'auteurs', $tmp);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>pg_meta_data</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
|
|
-->
|