mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-27 18:32:09 +01:00
195 lines
5.2 KiB
XML
195 lines
5.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: d15a12639faeb8d1b4bcf7eff008de2885017d1e Maintainer: girgias Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="sqlite3.openblob" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>SQLite3::openBlob</refname>
|
|
<refpurpose>Ouvre un flux de ressource pour lire un BLOB</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type class="union"><type>resource</type><type>false</type></type><methodname>SQLite3::openBlob</methodname>
|
|
<methodparam><type>string</type><parameter>table</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>column</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>rowid</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>database</parameter><initializer>"main"</initializer></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer><constant>SQLITE3_OPEN_READONLY</constant></initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Ouvre un flux de ressource pour lire ou écrire un BLOB, qui serait sélectionné par :
|
|
</para>
|
|
<para>
|
|
SELECT <parameter>column</parameter> FROM <parameter>database</parameter>.<parameter>table</parameter> WHERE rowid = <parameter>rowid</parameter>
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
Il n'est pas possible de changer la taille d'un BLOB en écrivant vers le flux.
|
|
À la place, une déclaration UPDATE doit être exécuté, en utilisant, éventuellement
|
|
la fonction zeroblob() de SQLite pour définir la taille du BLOB désiré.
|
|
</simpara>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>table</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le nom de la table.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>column</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le nom de la colonne.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>rowid</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La ligne ID.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>database</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le nom symbolic de la base de données.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>flags</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Soit <constant>SQLITE3_OPEN_READONLY</constant> ou
|
|
<constant>SQLITE3_OPEN_READWRITE</constant> pour ouvrir le flux
|
|
en lecture seule, ou en lecture et écriture, respectivement.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne une ressource de flux, &return.falseforfailure;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>7.2.0</entry>
|
|
<entry>
|
|
Le paramètre <parameter>flags</parameter> a été ajouté, permettant
|
|
d'écrire des BLOBs ; précédement seul la lecture était supporté.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>SQLite3::openBlob</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$conn = new SQLite3(':memory:');
|
|
$conn->exec('CREATE TABLE test (text text)');
|
|
$conn->exec("INSERT INTO test VALUES ('Lorem ipsum')");
|
|
$stream = $conn->openBlob('test', 'text', 1);
|
|
echo stream_get_contents($stream);
|
|
fclose($stream); // mandatory, otherwise the next line would fail
|
|
$conn->close();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Lorem ipsum
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Écrire progressivement un BLOB</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$conn = new SQLite3(':memory:');
|
|
$conn->exec('CREATE TABLE test (text text)');
|
|
$conn->exec("INSERT INTO test VALUES (zeroblob(36))");
|
|
$stream = $conn->openBlob('test', 'text', 1, 'main', SQLITE3_OPEN_READWRITE);
|
|
for ($i = 0; $i < 3; $i++) {
|
|
fwrite($stream, "Lorem ipsum\n");
|
|
}
|
|
fclose($stream);
|
|
echo $conn->querySingle("SELECT text FROM test");
|
|
$conn->close();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Lorem ipsum
|
|
Lorem ipsum
|
|
Lorem ipsum
|
|
]]>
|
|
</screen>
|
|
</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
|
|
-->
|