mirror of
https://github.com/php/doc-pl.git
synced 2026-03-24 15:12:16 +01:00
147 lines
4.2 KiB
XML
147 lines
4.2 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- EN-Revision: c2eca73ef79ebe78cebb34053e41b565af504c4f Maintainer: sobak Status: ready -->
|
|
<!-- $Revision$-->
|
|
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.61 -->
|
|
<!-- CREDITS: garbus, jarek -->
|
|
<refentry xml:id='function.pg-escape-bytea' xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_escape_bytea</refname>
|
|
<refpurpose>
|
|
Dodaje znaki ucieczki do łańcucha dodającego do pola typu bytea
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>pg_escape_bytea</methodname>
|
|
<methodparam choice="opt"><type>PgSql\Connection</type><parameter>connection</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>data</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>pg_escape_bytea</function> dodaje znaki ucieczki do
|
|
łańcucha dodającego do pola typu bytea. Zwraca zabezpieczony łańcuch.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Przy wywołaniu <literal>SELECT</literal> dla typu bytea, PostgrSQL zwraca łańcuchy
|
|
zawierające wartości ósemkowe poprzedzone znakiem "\" (np. \032).
|
|
Użytkownicy muszą samodzielnie odkodować te dane.
|
|
</para>
|
|
<para>
|
|
Ta funkcja wymaga PostgreSQL 7.2 lub nowszego. Dla PostgreSQL
|
|
7.2.0 i 7.2.1, wartości bytea muszą być wskazane jeśli uruchomisz
|
|
wsparcie dla kodowania wielobajtowego np. <literal>INSERT INTO tabela_testowa (obraz)
|
|
VALUES ('$image_escaped'::bytea);</literal> PostgreSQL 7.2.2 i nowszy
|
|
nie potrzebuje wskazania typu. Wyjątkiem jest przypadek kiedy klient i serwer
|
|
posługują się różnymi stronami kodowymi. W takim przypadku może wystąpić błąd (ang. multi-byte
|
|
stream error). Użytkownik musi wtedy wskazać typ bytea, by uniknąć tego błędu.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>connection</parameter></term>
|
|
<listitem>
|
|
&pgsql.parameter.connection-with-unspecified-default;
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>data</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Ciąg znaków (ang. <type>string</type>) zawierający tekst lub binarne dane wstawiane do kolumny
|
|
bytea.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Łańcuch (ang. <type>string</type>) zawierający dane z sekwencjami Escape..
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&pgsql.changelog.connection-object;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Przykład użycia <function>pg_escape_bytea</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// Połącz z bazą
|
|
$połączenie = pg_connect('dbname=foo');
|
|
|
|
// Przeczytaj z binarnego pliku
|
|
$dane = file_get_contents('obrazek1.jpg');
|
|
|
|
// Poprzedź sekwencjami Escape dane binarne
|
|
$escaped = pg_escape_bytea($dane);
|
|
|
|
// Wpisz to do bazy danych
|
|
pg_query("INSERT INTO galeria (nazwa, dane) VALUES ('Drzewa sosnowe', '{$escaped}')");
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>pg_unescape_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
|
|
-->
|