aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-protocol3.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/libpq/fe-protocol3.c')
-rw-r--r--src/interfaces/libpq/fe-protocol3.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c
index a4d6ee26749..e4ee9d69d25 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -202,8 +202,8 @@ pqParseInput3(PGconn *conn)
PGRES_COMMAND_OK);
if (!conn->result)
{
- printfPQExpBuffer(&conn->errorMessage,
- libpq_gettext("out of memory"));
+ appendPQExpBufferStr(&conn->errorMessage,
+ libpq_gettext("out of memory"));
pqSaveErrorResult(conn);
}
}
@@ -229,8 +229,8 @@ pqParseInput3(PGconn *conn)
PGRES_EMPTY_QUERY);
if (!conn->result)
{
- printfPQExpBuffer(&conn->errorMessage,
- libpq_gettext("out of memory"));
+ appendPQExpBufferStr(&conn->errorMessage,
+ libpq_gettext("out of memory"));
pqSaveErrorResult(conn);
}
}
@@ -246,8 +246,8 @@ pqParseInput3(PGconn *conn)
PGRES_COMMAND_OK);
if (!conn->result)
{
- printfPQExpBuffer(&conn->errorMessage,
- libpq_gettext("out of memory"));
+ appendPQExpBufferStr(&conn->errorMessage,
+ libpq_gettext("out of memory"));
pqSaveErrorResult(conn);
}
}
@@ -326,8 +326,8 @@ pqParseInput3(PGconn *conn)
PGRES_COMMAND_OK);
if (!conn->result)
{
- printfPQExpBuffer(&conn->errorMessage,
- libpq_gettext("out of memory"));
+ appendPQExpBufferStr(&conn->errorMessage,
+ libpq_gettext("out of memory"));
pqSaveErrorResult(conn);
}
}
@@ -361,8 +361,8 @@ pqParseInput3(PGconn *conn)
else
{
/* Set up to report error at end of query */
- printfPQExpBuffer(&conn->errorMessage,
- libpq_gettext("server sent data (\"D\" message) without prior row description (\"T\" message)\n"));
+ appendPQExpBufferStr(&conn->errorMessage,
+ libpq_gettext("server sent data (\"D\" message) without prior row description (\"T\" message)\n"));
pqSaveErrorResult(conn);
/* Discard the unexpected message */
conn->inCursor += msgLength;
@@ -404,7 +404,7 @@ pqParseInput3(PGconn *conn)
*/
break;
default:
- printfPQExpBuffer(&conn->errorMessage,
+ appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("unexpected response from server; first received character was \"%c\"\n"),
id);
/* build an error result holding the error message */
@@ -425,7 +425,7 @@ pqParseInput3(PGconn *conn)
else
{
/* Trouble --- report it */
- printfPQExpBuffer(&conn->errorMessage,
+ appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("message contents do not agree with length in message type \"%c\"\n"),
id);
/* build an error result holding the error message */
@@ -445,7 +445,7 @@ pqParseInput3(PGconn *conn)
static void
handleSyncLoss(PGconn *conn, char id, int msgLength)
{
- printfPQExpBuffer(&conn->errorMessage,
+ appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("lost synchronization with server: got message type \"%c\", length %d\n"),
id, msgLength);
/* build an error result holding the error message */
@@ -621,7 +621,7 @@ advance_and_error:
if (!errmsg)
errmsg = libpq_gettext("out of memory for query result");
- printfPQExpBuffer(&conn->errorMessage, "%s\n", errmsg);
+ appendPQExpBuffer(&conn->errorMessage, "%s\n", errmsg);
pqSaveErrorResult(conn);
/*
@@ -721,7 +721,7 @@ advance_and_error:
*/
if (!errmsg)
errmsg = libpq_gettext("out of memory");
- printfPQExpBuffer(&conn->errorMessage, "%s\n", errmsg);
+ appendPQExpBuffer(&conn->errorMessage, "%s\n", errmsg);
pqSaveErrorResult(conn);
/*
@@ -848,7 +848,7 @@ set_error_result:
if (!errmsg)
errmsg = libpq_gettext("out of memory for query result");
- printfPQExpBuffer(&conn->errorMessage, "%s\n", errmsg);
+ appendPQExpBuffer(&conn->errorMessage, "%s\n", errmsg);
pqSaveErrorResult(conn);
/*
@@ -950,8 +950,8 @@ pqGetErrorNotice3(PGconn *conn, bool isError)
pqClearAsyncResult(conn); /* redundant, but be safe */
conn->result = res;
if (PQExpBufferDataBroken(workBuf))
- printfPQExpBuffer(&conn->errorMessage,
- libpq_gettext("out of memory"));
+ appendPQExpBufferStr(&conn->errorMessage,
+ libpq_gettext("out of memory"));
else
appendPQExpBufferStr(&conn->errorMessage, workBuf.data);
}
@@ -1695,8 +1695,8 @@ pqGetCopyData3(PGconn *conn, char **buffer, int async)
*buffer = (char *) malloc(msgLength + 1);
if (*buffer == NULL)
{
- printfPQExpBuffer(&conn->errorMessage,
- libpq_gettext("out of memory\n"));
+ appendPQExpBufferStr(&conn->errorMessage,
+ libpq_gettext("out of memory\n"));
return -2;
}
memcpy(*buffer, &conn->inBuffer[conn->inCursor], msgLength);
@@ -1728,8 +1728,8 @@ pqGetline3(PGconn *conn, char *s, int maxlen)
conn->asyncStatus != PGASYNC_COPY_BOTH) ||
conn->copy_is_binary)
{
- printfPQExpBuffer(&conn->errorMessage,
- libpq_gettext("PQgetline: not doing text COPY OUT\n"));
+ appendPQExpBufferStr(&conn->errorMessage,
+ libpq_gettext("PQgetline: not doing text COPY OUT\n"));
*s = '\0';
return EOF;
}
@@ -1834,8 +1834,8 @@ pqEndcopy3(PGconn *conn)
conn->asyncStatus != PGASYNC_COPY_OUT &&
conn->asyncStatus != PGASYNC_COPY_BOTH)
{
- printfPQExpBuffer(&conn->errorMessage,
- libpq_gettext("no COPY in progress\n"));
+ appendPQExpBufferStr(&conn->errorMessage,
+ libpq_gettext("no COPY in progress\n"));
return 1;
}
@@ -1868,7 +1868,6 @@ pqEndcopy3(PGconn *conn)
/* Return to active duty */
conn->asyncStatus = PGASYNC_BUSY;
- resetPQExpBuffer(&conn->errorMessage);
/*
* Non blocking connections may have to abort at this point. If everyone
@@ -2091,7 +2090,7 @@ pqFunctionCall3(PGconn *conn, Oid fnid,
break;
default:
/* The backend violates the protocol. */
- printfPQExpBuffer(&conn->errorMessage,
+ appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("protocol error: id=0x%x\n"),
id);
pqSaveErrorResult(conn);