Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 5BE3B2E0206 for ; Thu, 6 Mar 2008 11:39:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 24936-07 for ; Thu, 6 Mar 2008 11:39:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from momjian.us (momjian.us [70.90.9.53]) by postgresql.org (Postfix) with ESMTP id 5D9D92E0137 for ; Thu, 6 Mar 2008 11:39:19 -0400 (AST) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id m26Fd5B20620; Thu, 6 Mar 2008 10:39:05 -0500 (EST) From: Bruce Momjian Message-Id: <200803061539.m26Fd5B20620@momjian.us> Subject: Re: Lack of docs for libpq C Library In-Reply-To: <8892.1201796537@sss.pgh.pa.us> To: Tom Lane Date: Thu, 6 Mar 2008 10:39:05 -0500 (EST) CC: Alvaro Herrera , Pavel Golub , pgsql-docs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ELM1204817945-8024-0_" Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/32 X-Sequence-Number: 4844 --ELM1204817945-8024-0_ Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" Tom Lane wrote: > Alvaro Herrera writes: > > I disagree. I think PQinitSSL is meant to be called from the > > application, for example. Same with PQsetClientEncoding. And the > > PQExpBuffer stuff is all very useful, and years ago when I wrote an app > > to use it it annoyed me that there were no docs on it. (Back then, I > > didn't realize I could have complained about it or written the docs > > myself). > > PQsetClientEncoding seems to be documented in the wrong place. I have moved the libpq client encoding documentation into the libpq doc section, and just referenced it from the localization docs. Backpatched to 8.3.X. -- Bruce Momjian http://momjian.us EnterpriseDB http://postgres.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + --ELM1204817945-8024-0_ Content-Transfer-Encoding: 7bit Content-Type: text/x-diff Content-Disposition: inline; filename="/rtmp/diff" Index: doc/src/sgml/charset.sgml =================================================================== RCS file: /cvsroot/pgsql/doc/src/sgml/charset.sgml,v retrieving revision 2.84 diff -c -c -r2.84 charset.sgml *** doc/src/sgml/charset.sgml 28 Sep 2007 22:25:49 -0000 2.84 --- doc/src/sgml/charset.sgml 6 Mar 2008 15:32:28 -0000 *************** *** 1110,1140 **** ! Using libpq functions. ! \encoding actually calls ! PQsetClientEncoding() for its purpose. ! ! ! int PQsetClientEncoding(PGconn *conn, const char *encoding); ! ! ! where 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: ! ! ! 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); ! --- 1110,1116 ---- ! libpq () has functions to control the client encoding. Index: doc/src/sgml/libpq.sgml =================================================================== RCS file: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v retrieving revision 1.255 diff -c -c -r1.255 libpq.sgml *** doc/src/sgml/libpq.sgml 31 Jan 2008 23:31:33 -0000 1.255 --- doc/src/sgml/libpq.sgml 6 Mar 2008 15:32:32 -0000 *************** *** 4417,4422 **** --- 4417,4472 ---- + PQclientEncoding + + PQclientEncoding + + + + + + Returns 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); + + + + + + + + PQsetClientEncoding + + PQsetClientEncoding + + + + + + Sets 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. + + + + + + PQsetErrorVerbosity PQsetErrorVerbosity --ELM1204817945-8024-0_--