Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
122923c9
Commit
122923c9
authored
Apr 25, 1999
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Still had a few MULTIBYTE problems when client encoding was
different from database's ...
parent
0d99c953
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
9 deletions
+40
-9
src/backend/libpq/pqformat.c
src/backend/libpq/pqformat.c
+31
-2
src/backend/tcop/dest.c
src/backend/tcop/dest.c
+3
-3
src/backend/utils/error/elog.c
src/backend/utils/error/elog.c
+3
-3
src/include/libpq/pqformat.h
src/include/libpq/pqformat.h
+3
-1
No files found.
src/backend/libpq/pqformat.c
View file @
122923c9
...
...
@@ -15,13 +15,13 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pqformat.c,v 1.
2 1999/04/25 19:27:44
tgl Exp $
* $Id: pqformat.c,v 1.
3 1999/04/25 21:50:56
tgl Exp $
*
*-------------------------------------------------------------------------
*/
/*
* INTERFACE ROUTINES
* Message output:
* Message
assembly and
output:
* pq_beginmessage - initialize StringInfo buffer
* pq_sendbyte - append a raw byte to a StringInfo buffer
* pq_sendint - append a binary integer to a StringInfo buffer
...
...
@@ -33,6 +33,9 @@
* the regular StringInfo routines, but this is discouraged since required
* MULTIBYTE conversion may not occur.
*
* Special-case message output:
* pq_puttextmessage - generate a MULTIBYTE-converted message in one step
*
* Message input:
* pq_getint - get an integer from connection
* pq_getstr - get a null terminated string from connection
...
...
@@ -209,6 +212,32 @@ pq_endmessage(StringInfo buf)
buf
->
data
=
NULL
;
}
/* --------------------------------
* pq_puttextmessage - generate a MULTIBYTE-converted message in one step
*
* This is the same as the pqcomm.c routine pq_putmessage, except that
* the message body is a null-terminated string to which MULTIBYTE
* conversion applies.
*
* returns 0 if OK, EOF if trouble
* --------------------------------
*/
int
pq_puttextmessage
(
char
msgtype
,
const
char
*
str
)
{
int
slen
=
strlen
(
str
);
#ifdef MULTIBYTE
const
char
*
p
;
p
=
(
const
char
*
)
pg_server_to_client
((
unsigned
char
*
)
str
,
slen
);
if
(
p
!=
str
)
/* actual conversion has been done? */
{
str
=
p
;
slen
=
strlen
(
str
);
}
#endif
return
pq_putmessage
(
msgtype
,
str
,
slen
+
1
);
}
/* --------------------------------
* pq_getint - get an integer from connection
*
...
...
src/backend/tcop/dest.c
View file @
122923c9
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.2
7 1999/04/25 19:27:45
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.2
8 1999/04/25 21:50:57
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -138,7 +138,7 @@ BeginCommand(char *pname,
* send fe info on tuples we're about to send
* ----------------
*/
pq_put
message
(
'P'
,
pname
,
strlen
(
pname
)
+
1
);
pq_put
textmessage
(
'P'
,
pname
);
/* ----------------
* if this is a retrieve, then we send back the tuple
...
...
@@ -272,7 +272,7 @@ EndCommand(char *commandTag, CommandDest dest)
* ----------------
*/
sprintf
(
buf
,
"%s%s"
,
commandTag
,
CommandInfo
);
pq_put
message
(
'C'
,
buf
,
strlen
(
buf
)
+
1
);
pq_put
textmessage
(
'C'
,
buf
);
CommandInfo
[
0
]
=
'\0'
;
break
;
...
...
src/backend/utils/error/elog.c
View file @
122923c9
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.4
2 1999/04/25 03:19:11
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.4
3 1999/04/25 21:50:57
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -31,6 +31,7 @@
#include "postgres.h"
#include "miscadmin.h"
#include "libpq/libpq.h"
#include "libpq/pqformat.h"
#include "storage/proc.h"
#include "tcop/tcopprot.h"
#include "utils/trace.h"
...
...
@@ -201,8 +202,7 @@ elog(int lev, const char *fmt,...)
msgtype
=
'E'
;
}
/* exclude the timestamp from msg sent to frontend */
pq_putmessage
(
msgtype
,
line
+
TIMESTAMP_SIZE
,
strlen
(
line
+
TIMESTAMP_SIZE
)
+
1
);
pq_puttextmessage
(
msgtype
,
line
+
TIMESTAMP_SIZE
);
/*
* This flush is normally not necessary, since postgres.c will
* flush out waiting data when control returns to the main loop.
...
...
src/include/libpq/pqformat.h
View file @
122923c9
...
...
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pqformat.h,v 1.
2 1999/04/25 19:27:47
tgl Exp $
* $Id: pqformat.h,v 1.
3 1999/04/25 21:50:58
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -24,6 +24,8 @@ extern void pq_sendstring(StringInfo buf, const char *str);
extern
void
pq_sendint
(
StringInfo
buf
,
int
i
,
int
b
);
extern
void
pq_endmessage
(
StringInfo
buf
);
extern
int
pq_puttextmessage
(
char
msgtype
,
const
char
*
str
);
extern
int
pq_getint
(
int
*
result
,
int
b
);
extern
int
pq_getstr
(
char
*
s
,
int
maxlen
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment