Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f0c3a09

Browse files
author
Neil Conway
committed
Document that PQoidValue(), PQcmdTuples(), and PQoidStatus() now work
when the command that generated the PGresult was an EXECUTE of an appropriate prepared statement.
1 parent 2ce964b commit f0c3a09

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

doc/src/sgml/libpq.sgml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.152 2004/04/24 00:14:28 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.153 2004/04/24 22:53:44 neilc Exp $
33
-->
44

55
<chapter id="libpq">
@@ -1941,14 +1941,19 @@ char *PQcmdTuples(PGresult *res);
19411941
</para>
19421942

19431943
<para>
1944-
If the <acronym>SQL</acronym> command that generated the
1945-
<structname>PGresult</structname> was <command>INSERT</>,
1946-
<command>UPDATE</>, <command>DELETE</command>, <command>MOVE</>,
1947-
or <command>FETCH</>, this returns a
1948-
string containing the number of rows affected. If the
1949-
command was anything else, it returns the empty string. The
1950-
caller should not free the result directly. It will be freed
1951-
when the associated <structname>PGresult</> handle is passed to
1944+
This function returns a string containing the number of rows
1945+
affected by the <acronym>SQL</> statement that generated the
1946+
<structname>PGresult</>. This function can only be used
1947+
following the execution of an <command>INSERT</>,
1948+
<command>UPDATE</>, <command>DELETE</>, <command>MOVE</>, or
1949+
<command>FETCH</> statement, or an <command>EXECUTE</> of a
1950+
prepared query that contains a <command>INSERT</>,
1951+
<command>UPDATE</>, or <command>DELETE</> statement. If the
1952+
command that generated the <structname>PGresult</> was
1953+
anything else, <function>PQcmdTuples</> returns the empty
1954+
string. The caller should not free the return value
1955+
directly. It will be freed when the associated
1956+
<structname>PGresult</> handle is passed to
19521957
<function>PQclear</function>.
19531958
</para>
19541959
</listitem>
@@ -1959,11 +1964,14 @@ char *PQcmdTuples(PGresult *res);
19591964
<listitem>
19601965
<para>
19611966
Returns the OID<indexterm><primary>OID</><secondary>in
1962-
libpq</></> of the inserted row, if the
1963-
<acronym>SQL</acronym> command was an
1964-
<command>INSERT</command> that inserted exactly one row into
1965-
a table that has OIDs. Otherwise, returns
1966-
<literal>InvalidOid</literal>.
1967+
libpq</></> of the inserted row, if the <acronym>SQL</>
1968+
command was an <command>INSERT</> that inserted exactly one
1969+
row into a table that has OIDs, or a <command>EXECUTE</> of
1970+
a prepared query containing a suitable <command>INSERT</>
1971+
statement. Otherwise, this function returns
1972+
<literal>InvalidOid</literal>. This function will also
1973+
return <literal>InvalidOid</literal> if the table affected
1974+
by the <command>INSERT</> statement does not contain OIDs.
19671975
<synopsis>
19681976
Oid PQoidValue(const PGresult *res);
19691977
</synopsis>
@@ -1977,7 +1985,9 @@ Oid PQoidValue(const PGresult *res);
19771985
<para>
19781986
Returns a string with the OID of the inserted row, if the
19791987
<acronym>SQL</acronym> command was an
1980-
<command>INSERT</command>. (The string will be
1988+
<command>INSERT</command> that inserted exactly one row, or
1989+
a <command>EXECUTE</command> of a prepared statement
1990+
consisting of a suitable <command>INSERT</command>. (The string will be
19811991
<literal>0</> if the <command>INSERT</command> did not
19821992
insert exactly one row, or if the target table does not have
19831993
OIDs.) If the command was not an <command>INSERT</command>,

0 commit comments

Comments
 (0)