-
Notifications
You must be signed in to change notification settings - Fork 152
/
pg-unescape-bytea.xml
121 lines (114 loc) · 3.55 KB
/
pg-unescape-bytea.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 58645a79f1993effc0571f7b49acc9aace0e417f Maintainer: yannick Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.pg-unescape-bytea" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>pg_unescape_bytea</refname>
<refpurpose>
Supprime la protection d'une chaîne de type bytea
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>pg_unescape_bytea</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_unescape_bytea</function> supprime la protection des
caractères de type bytea. Elle retourne la &string; protégée, pouvant
contenir des données binaires.
</para>
<note>
<para>
Lorsque vous utilisez une commande <literal>SELECT</literal>
avec des données de type bytea, PostgreSQL retourne des valeurs
octales, préfixées avec des antislashs \ (e.g. \032). Les utilisateurs
doivent effectuer la conversion en format binaire eux-mêmes.
</para>
<para>
<function>pg_escape_bytea</function> requiert PostgreSQL 7.2 ou plus récent. Avec
PostgreSQL 7.2.0 et 7.2.1, les données de type bytea doivent être transtypée
lorsque vous activez le support des chaînes de caractères multioctets.
i.e. <literal>INSERT INTO test_table (image) VALUES ('$image_escaped'::bytea);</literal>.
PostgreSQL 7.2.2 ou plus récent ne requiert pas cette manipulation.
Toutefois, si le client et le serveur n'utilisent pas le même jeu de caractères,
il peut arriver des erreurs. Il faut alors forcer le transtypage
manuellement pour éviter cette erreur.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
Une &string; contenant les données bytea PostgreSQL à être converties
en &string; binaire PHP.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Une &string; contenant les données protégées.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Exemple avec <function>pg_unescape_bytea</function></title>
<programlisting role="php">
<![CDATA[
<?php
// Connexion à la base de données
$dbconn = pg_connect('dbname=foo');
// Récupération des données bytea
$res = pg_query("SELECT data FROM galerie WHERE nom='Arbres Pin'");
$raw = pg_fetch_result($res, 'data');
// Convertit en binaire et envoie au navigateur
header('Content-type: image/jpeg');
echo pg_unescape_bytea($raw);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>pg_escape_bytea</function></member>
<member><function>pg_escape_string</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
-->