1
0
mirror of https://github.com/php/doc-pl.git synced 2026-04-24 07:18:15 +02:00
Files
Maciej Sobaczewski ff4d6f033a Sync with EN,
Ugh, I thought it's gonna be easier
2024-06-15 08:48:51 +02:00

143 lines
4.0 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- EN-Revision: c2eca73ef79ebe78cebb34053e41b565af504c4f Maintainer: garbus Status: ready -->
<!-- $Revision$-->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<!-- CREDITS: jarek, sobak -->
<refentry xml:id="function.pg-last-oid" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>pg_last_oid</refname>
<refpurpose>Zwraca identyfikator OID ostatniego wiersza</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>string</type><type>int</type><type>false</type></type><methodname>pg_last_oid</methodname>
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_last_oid</function> służy do pobrania <varname>OID</varname>
przypisanego do dopisanego wiersza.
</para>
<para>
OID jest polem opcjonalnym od wersji PostgreSQL 7.2 i nie pojawi
się domyślnie w PostgreSQL 8.1. Gdy
pole OID nie pojawia się w tabeli, programista musi użyć
<function>pg_result_status</function> aby sprawdzić czy rekord został
dopisany czy nie.
</para>
<para>
Aby pobrać wartość pola <literal>SERIAL</literal> we wstawionym
wierszu, niezbędnym jest użycie funkcji PostgreSQL <literal>CURRVAL</literal>,
przekazując sekwencję, której wymagana jest ostatnia wartość. Jeśli
nazwa sekwencji nie jest znana, konieczne jest użycie funkcji <literal>pg_get_serial_sequence</literal>
PostgreSQL-a 8.0.
</para>
<para>
PostgreSQL 8.1 ma funkcję <literal>LASTVAL</literal>, która zwraca
wartość ostatnio użytej sekwencji w sesji. To uchyla
potrzebę powoływania razem sekwencji, tabeli lub kolumny.
</para>
<note>
<para>
Ta funkcja była poprzednio nazwana <function>pg_getlastoid</function>.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result</parameter></term>
<listitem>
&pgsql.parameter.result;
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Liczba całkowita (<type>int</type>) lub ciąg znaków (<type>string</type>) zawierający OID przydzielony do ostatnio wstawionego
wiersza w określonym parametrem <parameter>connection</parameter> połączeniu, bądź &false; w przypadku błędu lub
gdy OID nie jest dostępny.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&pgsql.changelog.result-object;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Przykład użycia <function>pg_last_oid</function></title>
<programlisting role="php">
<![CDATA[
<?php
// Połącz z bazą danych
pg_connect("dbname=mark host=localhost");
// Stwórz prostą tabelę
pg_query("CREATE TABLE test (a INTEGER) WITH OIDS");
// Wstaw do niej jakieś dane
$res = pg_query("INSERT INTO test VALUES (1)");
$oid = pg_last_oid($res);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>pg_query</function></member>
<member><function>pg_result_status</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
-->