Skip to content

Commit a50f2fd

Browse files
committed
Repair unintentional damage to MULTIBYTE code.
1 parent 34235a2 commit a50f2fd

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/interfaces/libpq/fe-exec.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.92 2000/03/11 03:08:36 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.93 2000/03/14 23:59:23 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -153,8 +153,11 @@ PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status)
153153

154154
if (conn)
155155
{
156+
/* copy connection data we might need for operations on PGresult */
156157
result->noticeHook = conn->noticeHook;
157158
result->noticeArg = conn->noticeArg;
159+
result->client_encoding = conn->client_encoding;
160+
158161
/* consider copying conn's errorMessage */
159162
switch (status)
160163
{
@@ -172,8 +175,10 @@ PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status)
172175
}
173176
else
174177
{
178+
/* defaults... */
175179
result->noticeHook = NULL;
176180
result->noticeArg = NULL;
181+
result->client_encoding = 0; /* should be SQL_ASCII */
177182
}
178183

179184
return result;

src/interfaces/libpq/fe-print.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* didn't really belong there.
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.35 2000/02/07 23:10:11 petere Exp $
13+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.36 2000/03/14 23:59:23 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -347,7 +347,7 @@ do_field(const PQprintOpt *po, const PGresult *res,
347347
char ch = '0';
348348

349349
#ifdef MULTIBYTE
350-
for (p = pval; *p; p += PQmblen(p, PQclientEncoding(res->conn)))
350+
for (p = pval; *p; p += PQmblen(p, res->client_encoding))
351351
#else
352352
for (p = pval; *p; p++)
353353
#endif

src/interfaces/libpq/libpq-int.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $Id: libpq-int.h,v 1.20 2000/03/11 03:08:37 tgl Exp $
15+
* $Id: libpq-int.h,v 1.21 2000/03/14 23:59:23 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -130,11 +130,14 @@ struct pg_result
130130
*/
131131
PGconn *xconn; /* connection we did the query on, if any */
132132

133-
/* Callback procedure for notice/error message processing
134-
* (copied from originating PGconn).
133+
/*
134+
* These fields are copied from the originating PGconn, so that
135+
* operations on the PGresult don't have to reference the PGconn.
135136
*/
136-
PQnoticeProcessor noticeHook;
137+
PQnoticeProcessor noticeHook; /* notice/error message processor */
137138
void *noticeArg;
139+
int client_encoding; /* encoding id */
140+
138141

139142
char *errMsg; /* error message, or NULL if no error */
140143

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy