mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-26 01:42:09 +01:00
241 lines
6.8 KiB
XML
241 lines
6.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: ed6de1ae20ce16c0c7be0b3fef282b6065bebfac Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
|
|
<refentry xml:id="function.oci-bind-array-by-name" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>oci_bind_array_by_name</refname>
|
|
<refpurpose>Lie un tableau PHP à un paramètre de tableau Oracle PL/SQL</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>oci_bind_array_by_name</methodname>
|
|
<methodparam><type>resource</type><parameter>statement</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>param</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter role="reference">var</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>max_array_length</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>max_item_length</parameter><initializer>-1</initializer></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>type</parameter><initializer><constant>SQLT_AFC</constant></initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Lie un tableau PHP <parameter>var</parameter> à un marqueur
|
|
Oracle <parameter>param</parameter>, qui pointe vers un tableau PL/SQL.
|
|
Il peut être utilisé pour l'entrée ou la sortie, suivant la configuration à l'exécution.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>statement</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Un identifiant de requête OCI valide.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>param</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le marqueur Oracle.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>var</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Un tableau.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>max_array_length</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Spécifie la longueur maximale des tableaux d'entrées et de résultats.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>max_item_length</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Définit la longueur maximale pour les éléments du tableau.
|
|
Si <parameter>max_item_length</parameter> n'est pas fourni
|
|
ou s'il vaut -1, <function>oci_bind_array_by_name</function> cherchera
|
|
l'élément le plus long dans le tableau d'entrée et l'utilisera en tant que
|
|
longueur maximale.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>type</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Devrait être utilisé pour définir le type des éléments PL/SQL.
|
|
Voir la liste des types disponibles ci-dessous :
|
|
</para>
|
|
<para>
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
<constant>SQLT_NUM</constant> - pour les tableaux de NUMBER.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<constant>SQLT_INT</constant> - pour les tableaux INTEGER (Note : INTEGER
|
|
c'est actuellement un synonyme pour NUMBER(38), mais le type
|
|
<constant>SQLT_NUM</constant> ne fonctionnera pas dans ce cas même s'ils sont synonymes).
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<constant>SQLT_FLT</constant> - pour les tableaux de FLOAT.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<constant>SQLT_AFC</constant> - pour les tableaux de CHAR.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<constant>SQLT_CHR</constant> - pour les tableaux de VARCHAR2.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<constant>SQLT_VCS</constant> - pour les tableaux de VARCHAR.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<constant>SQLT_AVC</constant> - pour les tableaux de CHARZ.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<constant>SQLT_STR</constant> - pour les tableaux de STRING.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<constant>SQLT_LVC</constant> - pour les tableaux de LONG VARCHAR.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<constant>SQLT_ODT</constant> - pour les tableaux de DATE.
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>oci_bind_array_by_name</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$conn = oci_connect("hr", "hrpwd", "localhost/XE");
|
|
if (!$conn) {
|
|
$m = oci_error();
|
|
trigger_error(htmlentities($m['message']), E_USER_ERROR);
|
|
}
|
|
|
|
$create = "CREATE TABLE bind_example(name VARCHAR(20))";
|
|
$stid = oci_parse($conn, $create);
|
|
oci_execute($stid);
|
|
|
|
$create_pkg = "
|
|
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
|
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
|
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
|
END ARRAYBINDPKG1;";
|
|
$stid = oci_parse($conn, $create_pkg);
|
|
oci_execute($stid);
|
|
|
|
$create_pkg_body = "
|
|
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
|
CURSOR CUR IS SELECT name FROM bind_example;
|
|
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
|
BEGIN
|
|
-- Bulk Insert
|
|
FORALL i IN INDICES OF c1
|
|
INSERT INTO bind_example VALUES (c1(i));
|
|
|
|
-- Fetch and reverse;
|
|
IF NOT CUR%ISOPEN THEN
|
|
OPEN CUR;
|
|
END IF;
|
|
FOR i IN REVERSE 1..5 LOOP
|
|
FETCH CUR INTO c1(i);
|
|
IF CUR%NOTFOUND THEN
|
|
CLOSE CUR;
|
|
EXIT;
|
|
END IF;
|
|
END LOOP;
|
|
END iobind;
|
|
END ARRAYBINDPKG1;";
|
|
$stid = oci_parse($conn, $create_pkg_body);
|
|
oci_execute($stid);
|
|
|
|
$stid = oci_parse($conn, "BEGIN arraybindpkg1.iobind(:c1); END;");
|
|
$array = array("one", "two", "three", "four", "five");
|
|
oci_bind_array_by_name($stid, ":c1", $array, 5, -1, SQLT_CHR);
|
|
oci_execute($stid);
|
|
|
|
var_dump($array);
|
|
|
|
?>
|
|
]]>
|
|
</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:"~/.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
|
|
-->
|