| PostgreSQL Reference Manual - Volume 2 - Programming Guide by The PostgreSQL Global Development Group Paperback (6"x9"), 408 pages ISBN 0954612035 RRP £19.95 ($34.95) Sales of this book support the PostgreSQL project! Get a printed copy>>> |
1.3.3 Retrieving Result Information for Other Commands
These functions are used to extract information from
PGresult objects that are not SELECT
results.
PQcmdStatus-
Returns the command status tag from the SQL command that
generated the
PGresult.char *PQcmdStatus(PGresult *res);
Commonly this is just the name of the command, but it may include additional data such as the number of rows processed. The caller should not free the result directly. It will be freed when the associatedPGresulthandle is passed toPQclear. PQcmdTuples-
Returns the number of rows affected by the SQL command.
char *PQcmdTuples(PGresult *res);
This function returns a string containing the number of rows affected by the SQL statement that generated thePGresult. This function can only be used following the execution of anINSERT,UPDATE,DELETE,MOVE,FETCH, orCOPYstatement, or anEXECUTEof a prepared query that contains anINSERT,UPDATE, orDELETEstatement. If the command that generated thePGresultwas anything else,PQcmdTuplesreturns an empty string. The caller should not free the return value directly. It will be freed when the associatedPGresulthandle is passed toPQclear. PQoidValue-
Returns the OID
of the inserted row, if the SQL
command was an
INSERTthat inserted exactly one row into a table that has OIDs, or aEXECUTEof a prepared query containing a suitableINSERTstatement. Otherwise, this function returnsInvalidOid. This function will also returnInvalidOidif the table affected by theINSERTstatement does not contain OIDs.Oid PQoidValue(const PGresult *res);
PQoidStatus-
Returns a string with the OID of the inserted row, if the
SQL command was an
INSERTthat inserted exactly one row, or aEXECUTEof a prepared statement consisting of a suitableINSERT. (The string will be0if theINSERTdid not insert exactly one row, or if the target table does not have OIDs.) If the command was not anINSERT, returns an empty string.char *PQoidStatus(const PGresult *res);
This function is deprecated in favor ofPQoidValue. It is not thread-safe.
| ISBN 0954612035 | PostgreSQL Reference Manual - Volume 2 - Programming Guide | See the print edition |