mirror of
https://github.com/php/doc-pl.git
synced 2026-03-24 07:02:07 +01:00
180 lines
5.3 KiB
XML
180 lines
5.3 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- EN-Revision: 39bb8a868935a56cfce438b0169e13c02c93211c Maintainer: garbus Status: ready -->
|
|
<!-- $Revision$-->
|
|
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 -->
|
|
<!-- CREDITS: jarek, sobak -->
|
|
<refentry xml:id="function.pg-convert" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_convert</refname>
|
|
<refpurpose>
|
|
Konwertuje tablice asocjacyjne na postać użyteczną w zapytaniu SQL.
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>array</type><type>false</type></type><methodname>pg_convert</methodname>
|
|
<methodparam><type>PgSql\Connection</type><parameter>connection</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>values</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>pg_convert</function> sprawdza i konwertuje wartości w tablicy
|
|
<parameter>values</parameter> na postać użyteczną dla
|
|
zapytania SQL. Warunkiem koniecznym dla <function>pg_convert</function> jest
|
|
istnienie tabeli <parameter>table_name</parameter>, która ma przynajmniej
|
|
tyle kolumn, ile <parameter>values</parameter> ma elementów. Nazwy
|
|
pól w tabeli muszą pasować do indeksów w parametrze
|
|
<parameter>values</parameter> a odpowiednie typy danych muszą być
|
|
zgodne. Zwraca tabelę z przekonwertowanymi wartościami w razie sukcesu, &false;
|
|
w przeciwnym wypadku.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Wartości logiczne są akceptowane i konwertowane do wartości
|
|
logicznej PostgreSQL. Reprezentacja wartości logicznych w postaci ciągu znaków również
|
|
jest wspierana. &null; jest konwertowane do NULL z PostgreSQL.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>connection</parameter></term>
|
|
<listitem>
|
|
&pgsql.parameter.connection;
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>table_name</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Nazwa tabeli, w stosunku do której będą konwertowane typy.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>values</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Dane do konwersji.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>flags</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Kombinacja dowolnej ilości poniższych stałych: <constant>PGSQL_CONV_IGNORE_DEFAULT</constant>,
|
|
<constant>PGSQL_CONV_FORCE_NULL</constant> lub
|
|
<constant>PGSQL_CONV_IGNORE_NOT_NULL</constant>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Tablica (<type>array</type>) z przekonwertowanymi wartościami &return.falseforfailure;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Jeśli wartość lub typ pola nie pasuje poprawnie do typu PostreSQL,
|
|
to rzucany jest <classname>ValueError</classname> lub <classname>TypeError</classname>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.3.0</entry>
|
|
<entry>
|
|
Funkcja rzuca teraz błąd <classname>ValueError</classname> lub <classname>TypeError</classname>
|
|
jeśli wartość lub typ pola nie psuje poprawnie do typu PostreSQL;
|
|
wcześniej emitowane było ostrzeżenie (<constant>E_WARNING</constant>).
|
|
</entry>
|
|
</row>
|
|
&pgsql.changelog.connection-object;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Przykład użycia <function>pg_convert</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$polaczenie = pg_connect('dbname=foo');
|
|
|
|
$tmp = array(
|
|
'autor' => 'Jan Hakreski',
|
|
'rok' => 2005,
|
|
'tytuł' => 'Życie Jana Hakerskiego'
|
|
);
|
|
|
|
$wartosci = pg_convert($polaczenie, 'autorzy', $tmp);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>pg_meta_data</function></member>
|
|
<member><function>pg_insert</function></member>
|
|
<member><function>pg_select</function></member>
|
|
<member><function>pg_update</function></member>
|
|
<member><function>pg_delete</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
|
|
-->
|