| PostgreSQL 9.2.4 Documentation | ||||
|---|---|---|---|---|
| Prev | Up | Chapter 31. libpq - C Library | Next | |
These functions control miscellaneous details of libpq's behavior.
PQclientEncodingReturns the client encoding.
int PQclientEncoding(const PGconn *conn);
Note that it returns the encoding ID, not a symbolic string such as EUC_JP. To convert an encoding ID to an encoding name, you can use:
char *pg_encoding_to_char(int encoding_id);
PQsetClientEncodingSets the client encoding.
int PQsetClientEncoding(PGconn *conn, const char *encoding);
conn is a connection to
the server, and encoding is
the encoding you want to use. If the function successfully
sets the encoding, it returns 0, otherwise -1. The current
encoding for this connection can be determined by using
PQclientEncoding.
PQsetErrorVerbosityDetermines the verbosity of messages returned by
PQerrorMessage and
PQresultErrorMessage.
typedef enum
{
PQERRORS_TERSE,
PQERRORS_DEFAULT,
PQERRORS_VERBOSE
} PGVerbosity;
PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity);
PQsetErrorVerbosity sets
the verbosity mode, returning the connection's previous
setting. In TERSE mode, returned
messages include severity, primary text, and position only;
this will normally fit on a single line. The default mode
produces messages that include the above plus any detail,
hint, or context fields (these might span multiple lines).
The VERBOSE mode includes all
available fields. Changing the verbosity does not affect
the messages available from already-existing PGresult objects, only
subsequently-created ones.
PQtraceEnables tracing of the client/server communication to a debugging file stream.
void PQtrace(PGconn *conn, FILE *stream);
Note: On Windows, if the libpq library and an application are compiled with different flags, this function call will crash the application because the internal representation of the FILE pointers differ. Specifically, multithreaded/single-threaded, release/debug, and static/dynamic flags should be the same for the library and all applications using that library.
PQuntraceDisables tracing started by PQtrace.
void PQuntrace(PGconn *conn);
Please use this form to add your own comments regarding your experience with particular features of PostgreSQL, clarifications of the documentation, or hints for other users. Please note, this is not a support forum, and your IP address will be logged. If you have a question or need help, please see the faq, try a mailing list, or join us on IRC. Note that submissions containing URLs or other keywords commonly found in 'spam' comments may be silently discarded. Please contact the webmaster if you think this is happening to you in error.
Proceed to the comment form.