П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
  
Поиск по сайту:
                                                 
Главная

О проекте

Web-мастеру
     HTML & JavaScript
     SSI
     Perl
     PHP
     XML & XSLT
     Unix Shell

MySQL

Безопасность

Хостинг

Другое








Самое читаемое:

Учебник PHP - "Для Чайника".
Просмотров 6443 раз(а).

Иллюстрированный самоучитель по созданию сайтов.
Просмотров 8558 раз(а).

Учебник HTML.
Просмотров 5171 раз(а).

Руководство по PHP5.
Просмотров 2329 раз(а).

Хостинг через призму DNS.
Просмотров 7531 раз(а).

Подборка текстов стандартных документов.
Просмотров 149 раз(а).

Учебник PHP - Самоучитель
Просмотров 5443 раз(а).

Документация на MySQL (учебник & справочное руководство)
Просмотров 11655 раз(а).

Внешние атаки...
Просмотров 7903 раз(а).

Учебник PHP.
Просмотров 4566 раз(а).

SSI в примерах.
Просмотров 1402 раз(а).



 
 
| Добавить в избранное | Сделать стартовой | Помощь





Руководство по PHP
Пред. След.

pg_last_oid

(PHP 4 >= 4.2.0, PHP 5)

pg_last_oid -- Returns the last row's OID

Описание

string pg_last_oid ( resource result )

pg_last_oid() is used to retrieve the OID assigned to an inserted row.

OID field became an optional field from PostgreSQL 7.2 and will not be present by default in PostgreSQL 8.1. When the OID field is not present in a table, the programmer must use pg_result_status() to check for successful insertion.

To get the value of a SERIAL field in an inserted row, it is necessary to use the PostgreSQL CURRVAL function, naming the sequence whose last value is required. If the name of the sequence is unknown, the pg_get_serial_sequence PostgreSQL 8.0 function is necessary.

PostgreSQL 8.1 has a function LASTVAL that returns the value of the most recently used sequence in the session. This avoids the need for naming the sequence, table or column altogether.

Замечание: This function used to be called pg_getlastoid().

Список параметров

result

PostgreSQL query result resource, returned by pg_query(), pg_query_params() or pg_execute() (among others).

Возвращаемые значения

A string containing the OID assigned to the most recently inserted row in the specified connection, or FALSE on error or no available OID.

Примеры

Пример 1. pg_last_oid() example

<?php
  $pgsql_conn
= pg_connect("dbname=mark host=localhost");
  
  
$res1 = pg_query("CREATE TABLE test (a INTEGER) WITH OIDS");

  
$res2 = pg_query("INSERT INTO test VALUES (1)");
  
  
$oid = pg_last_oid($res2);
?>

Смотрите также

pg_query()
pg_result_status()



Если Вы не нашли что искали, то рекомендую воспользоваться поиском по сайту:
 





Copyright © 2005-2016 Project.Net.Ru