aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-03-14 23:59:23 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-03-14 23:59:23 +0000
commita50f2fd76e322eae0f2a7f3516da1f2ddf82fef2 (patch)
tree1ba8e93236d6d8038729d8c42357ad7bf85cd034 /src
parent34235a295b307d3c50b2a74b20936f01b4ba76be (diff)
downloadpostgresql-a50f2fd76e322eae0f2a7f3516da1f2ddf82fef2.tar.gz
postgresql-a50f2fd76e322eae0f2a7f3516da1f2ddf82fef2.zip
Repair unintentional damage to MULTIBYTE code.
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/libpq/fe-exec.c7
-rw-r--r--src/interfaces/libpq/fe-print.c4
-rw-r--r--src/interfaces/libpq/libpq-int.h11
3 files changed, 15 insertions, 7 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index 5d614ebe375..6b3999193d5 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.92 2000/03/11 03:08:36 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.93 2000/03/14 23:59:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -153,8 +153,11 @@ PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status)
if (conn)
{
+ /* copy connection data we might need for operations on PGresult */
result->noticeHook = conn->noticeHook;
result->noticeArg = conn->noticeArg;
+ result->client_encoding = conn->client_encoding;
+
/* consider copying conn's errorMessage */
switch (status)
{
@@ -172,8 +175,10 @@ PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status)
}
else
{
+ /* defaults... */
result->noticeHook = NULL;
result->noticeArg = NULL;
+ result->client_encoding = 0; /* should be SQL_ASCII */
}
return result;
diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c
index 3b9102d4d84..840f47e5796 100644
--- a/src/interfaces/libpq/fe-print.c
+++ b/src/interfaces/libpq/fe-print.c
@@ -10,7 +10,7 @@
* didn't really belong there.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.35 2000/02/07 23:10:11 petere Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.36 2000/03/14 23:59:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -347,7 +347,7 @@ do_field(const PQprintOpt *po, const PGresult *res,
char ch = '0';
#ifdef MULTIBYTE
- for (p = pval; *p; p += PQmblen(p, PQclientEncoding(res->conn)))
+ for (p = pval; *p; p += PQmblen(p, res->client_encoding))
#else
for (p = pval; *p; p++)
#endif
diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h
index 92bd9cfba83..bb0fb8ab4a0 100644
--- a/src/interfaces/libpq/libpq-int.h
+++ b/src/interfaces/libpq/libpq-int.h
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: libpq-int.h,v 1.20 2000/03/11 03:08:37 tgl Exp $
+ * $Id: libpq-int.h,v 1.21 2000/03/14 23:59:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -130,11 +130,14 @@ struct pg_result
*/
PGconn *xconn; /* connection we did the query on, if any */
- /* Callback procedure for notice/error message processing
- * (copied from originating PGconn).
+ /*
+ * These fields are copied from the originating PGconn, so that
+ * operations on the PGresult don't have to reference the PGconn.
*/
- PQnoticeProcessor noticeHook;
+ PQnoticeProcessor noticeHook; /* notice/error message processor */
void *noticeArg;
+ int client_encoding; /* encoding id */
+
char *errMsg; /* error message, or NULL if no error */