Returns the error message most recently generated by
an operation on the connection.
-char *PQerrorMessage(const PGconn* conn);
+char *PQerrorMessage(const PGconn *conn);
PQerrorMessage if they fail.
Note that by
libpq convention, a nonempty
PQerrorMessage result will
- include a trailing newline.
+ include a trailing newline. The caller should not free the result
+ directly. It will be freed when the associated PGconn>
+ handle is passed to PQfinish.
Converts the enumerated type returned by PQresultStatus> into
- a string constant describing the status code.
+ a string constant describing the status code. The caller should not
+ free the result.
char *PQresStatus(ExecStatusType status);
char *PQresultErrorMessage(const PGresult *res);
-If there was an error, the returned string will include a trailing newline.
+If there was an error, the returned string will include a trailing newline.
+The caller should not free the result directly. It will be freed when the
+associated PGresult> handle is passed to
+PQclear.
listed below. NULL is returned if the
PGresult is not an error or warning result,
or does not include the specified field. Field values will normally
-not include a trailing newline.
+not include a trailing newline. The caller should not free the
+result directly. It will be freed when the
+associated PGresult> handle is passed to
+PQclear.
- Returns the column name associated with the given column number.
- Column numbers start at 0.
+Returns the column name associated with the given column number.
+Column numbers start at 0. The caller should not free the result
+directly. It will be freed when the associated PGresult>
+handle is passed to PQclear.
char *PQfname(const PGresult *res,
int column_number);
The given name is treated like an identifier in an SQL command,
- that is, it is downcased unless double-quoted. For example,
- given a query result generated from the SQL command
+ that is, it is downcased unless double-quoted. For example,
+ given a query result generated from the SQL command
select 1 as FOO, 2 as "BAR";
- Returns a single field value of one row
- of a PGresult.
- Row and column numbers start at 0.
+ Returns a single field value of one row of a
+ PGresult. Row and column numbers
+ start at 0. The caller should not free the result
+ directly. It will be freed when the associated
+ PGresult> handle is passed to
+ PQclear.
-char* PQgetvalue(const PGresult *res,
+char *PQgetvalue(const PGresult *res,
int row_number,
int column_number);
Returns the command status tag from the SQL command that
generated the PGresult.
-char * PQcmdStatus(PGresult *res);
+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.
+data such as the number of rows processed. The caller should
+not free the result directly. It will be freed when the
+associated PGresult> handle is passed to
+PQclear.
Returns the number of rows affected by the SQL command.
-char * PQcmdTuples(PGresult *res);
+char *PQcmdTuples(PGresult *res);
UPDATE>, DELETE, MOVE>,
or FETCH>, this returns a
string containing the number of rows affected. If the
- command was anything else, it returns the empty string.
+ command was anything else, it returns the empty string. The
+ caller should not free the result directly. It will be freed
+ when the associated PGresult> handle is passed to
+ PQclear.
OIDs.) If the command was not an INSERT,
returns an empty string.
-char * PQoidStatus(const PGresult *res);
+char *PQoidStatus(const PGresult *res);
requests execution of a server function via the fast-path interface:
-PGresult* PQfn(PGconn* conn,
+PGresult *PQfn(PGconn *conn,
int fnid,
int *result_buf,
int *result_len,
returned from PQnotifies>, it is considered handled and will be
removed from the list of notifications.
-PGnotify* PQnotifies(PGconn *conn);
+PGnotify *PQnotifies(PGconn *conn);
typedef struct pgNotify {
char *relname; /* notification condition name */
The default notice processor is simply
static void
-defaultNoticeProcessor(void * arg, const char * message)
+defaultNoticeProcessor(void *arg, const char *message)
{
fprintf(stderr, "%s", message);
}