php man page for pg_last_oid

Query: pg_last_oid

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

PG_LAST_OID(3)															    PG_LAST_OID(3)

pg_last_oid - Returns the last row's OID

SYNOPSIS
string pg_last_oid (resource $result)
DESCRIPTION
pg_last_oid(3) 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(3) 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. Note This function used to be called pg_getlastoid(3).
PARAMETERS
o $result - PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others).
RETURN VALUES
A string containing the OID assigned to the most recently inserted row in the specified $connection, or FALSE on error or no available OID.
EXAMPLES
Example #1 pg_last_oid(3) example <?php // Connect to the database pg_connect("dbname=mark host=localhost"); // Create a sample table pg_query("CREATE TABLE test (a INTEGER) WITH OIDS"); // Insert some data into it $res = pg_query("INSERT INTO test VALUES (1)"); $oid = pg_last_oid($res); ?>
SEE ALSO
pg_query(3), pg_result_status(3). PHP Documentation Group PG_LAST_OID(3)
Related Man Pages
pg_fetch_array(3) - php
pg_lo_create(3) - php
pg_lo_import(3) - php
pg_put_line(3) - php
pg_set_client_encoding(3) - php
Similar Topics in the Unix Linux Community
Hiding Passwords while typing..
Testing Var for 3 digits in a row only
Debian: PostgreSQL several vulnerabilities
Ubuntu: 1058-1: PostgreSQL vulnerability
Check a field in a table