mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Introduce macros for protocol characters.
This commit introduces descriptively-named macros for the identifiers used in wire protocol messages. These new macros are placed in a new header file so that they can be easily used by third-party code. Author: Dave Cramer Reviewed-by: Alvaro Herrera, Tatsuo Ishii, Peter Smith, Robert Haas, Tom Lane, Peter Eisentraut, Michael Paquier Discussion: https://postgr.es/m/CADK3HHKbBmK-PKf1bPNFoMC%2BoBt%2BpD9PH8h5nvmBQskEHm-Ehw%40mail.gmail.com
This commit is contained in:
@@ -152,7 +152,7 @@ bbsink_copystream_begin_backup(bbsink *sink)
|
||||
SendTablespaceList(state->tablespaces);
|
||||
|
||||
/* Send a CommandComplete message */
|
||||
pq_puttextmessage('C', "SELECT");
|
||||
pq_puttextmessage(PqMsg_CommandComplete, "SELECT");
|
||||
|
||||
/* Begin COPY stream. This will be used for all archives + manifest. */
|
||||
SendCopyOutResponse();
|
||||
@@ -169,7 +169,7 @@ bbsink_copystream_begin_archive(bbsink *sink, const char *archive_name)
|
||||
StringInfoData buf;
|
||||
|
||||
ti = list_nth(state->tablespaces, state->tablespace_num);
|
||||
pq_beginmessage(&buf, 'd'); /* CopyData */
|
||||
pq_beginmessage(&buf, PqMsg_CopyData);
|
||||
pq_sendbyte(&buf, 'n'); /* New archive */
|
||||
pq_sendstring(&buf, archive_name);
|
||||
pq_sendstring(&buf, ti->path == NULL ? "" : ti->path);
|
||||
@@ -220,7 +220,7 @@ bbsink_copystream_archive_contents(bbsink *sink, size_t len)
|
||||
{
|
||||
mysink->last_progress_report_time = now;
|
||||
|
||||
pq_beginmessage(&buf, 'd'); /* CopyData */
|
||||
pq_beginmessage(&buf, PqMsg_CopyData);
|
||||
pq_sendbyte(&buf, 'p'); /* Progress report */
|
||||
pq_sendint64(&buf, state->bytes_done);
|
||||
pq_endmessage(&buf);
|
||||
@@ -246,7 +246,7 @@ bbsink_copystream_end_archive(bbsink *sink)
|
||||
|
||||
mysink->bytes_done_at_last_time_check = state->bytes_done;
|
||||
mysink->last_progress_report_time = GetCurrentTimestamp();
|
||||
pq_beginmessage(&buf, 'd'); /* CopyData */
|
||||
pq_beginmessage(&buf, PqMsg_CopyData);
|
||||
pq_sendbyte(&buf, 'p'); /* Progress report */
|
||||
pq_sendint64(&buf, state->bytes_done);
|
||||
pq_endmessage(&buf);
|
||||
@@ -261,7 +261,7 @@ bbsink_copystream_begin_manifest(bbsink *sink)
|
||||
{
|
||||
StringInfoData buf;
|
||||
|
||||
pq_beginmessage(&buf, 'd'); /* CopyData */
|
||||
pq_beginmessage(&buf, PqMsg_CopyData);
|
||||
pq_sendbyte(&buf, 'm'); /* Manifest */
|
||||
pq_endmessage(&buf);
|
||||
}
|
||||
@@ -318,7 +318,7 @@ SendCopyOutResponse(void)
|
||||
{
|
||||
StringInfoData buf;
|
||||
|
||||
pq_beginmessage(&buf, 'H');
|
||||
pq_beginmessage(&buf, PqMsg_CopyOutResponse);
|
||||
pq_sendbyte(&buf, 0); /* overall format */
|
||||
pq_sendint16(&buf, 0); /* natts */
|
||||
pq_endmessage(&buf);
|
||||
@@ -330,7 +330,7 @@ SendCopyOutResponse(void)
|
||||
static void
|
||||
SendCopyDone(void)
|
||||
{
|
||||
pq_putemptymessage('c');
|
||||
pq_putemptymessage(PqMsg_CopyDone);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -368,7 +368,7 @@ SendXlogRecPtrResult(XLogRecPtr ptr, TimeLineID tli)
|
||||
end_tup_output(tstate);
|
||||
|
||||
/* Send a CommandComplete message */
|
||||
pq_puttextmessage('C', "SELECT");
|
||||
pq_puttextmessage(PqMsg_CommandComplete, "SELECT");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user