PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
dbasedesc.c File Reference
#include "postgres.h"
#include "commands/dbcommands_xlog.h"
#include "lib/stringinfo.h"
Include dependency graph for dbasedesc.c:

Go to the source code of this file.

Functions

void dbase_desc (StringInfo buf, XLogReaderState *record)
 
const char * dbase_identify (uint8 info)
 

Function Documentation

void dbase_desc ( StringInfo  buf,
XLogReaderState record 
)

Definition at line 22 of file dbasedesc.c.

References appendStringInfo(), xl_dbase_create_rec::db_id, xl_dbase_drop_rec::db_id, xl_dbase_create_rec::src_db_id, xl_dbase_create_rec::src_tablespace_id, xl_dbase_create_rec::tablespace_id, xl_dbase_drop_rec::tablespace_id, XLOG_DBASE_CREATE, XLOG_DBASE_DROP, XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.

23 {
24  char *rec = XLogRecGetData(record);
25  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
26 
27  if (info == XLOG_DBASE_CREATE)
28  {
30 
31  appendStringInfo(buf, "copy dir %u/%u to %u/%u",
32  xlrec->src_db_id, xlrec->src_tablespace_id,
33  xlrec->db_id, xlrec->tablespace_id);
34  }
35  else if (info == XLOG_DBASE_DROP)
36  {
37  xl_dbase_drop_rec *xlrec = (xl_dbase_drop_rec *) rec;
38 
39  appendStringInfo(buf, "dir %u/%u",
40  xlrec->db_id, xlrec->tablespace_id);
41  }
42 }
unsigned char uint8
Definition: c.h:266
#define XLogRecGetData(decoder)
Definition: xlogreader.h:220
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:78
#define XLOG_DBASE_DROP
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:216
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_DBASE_CREATE
const char* dbase_identify ( uint8  info)

Definition at line 45 of file dbasedesc.c.

References NULL, XLOG_DBASE_CREATE, XLOG_DBASE_DROP, and XLR_INFO_MASK.

46 {
47  const char *id = NULL;
48 
49  switch (info & ~XLR_INFO_MASK)
50  {
51  case XLOG_DBASE_CREATE:
52  id = "CREATE";
53  break;
54  case XLOG_DBASE_DROP:
55  id = "DROP";
56  break;
57  }
58 
59  return id;
60 }
#define XLOG_DBASE_DROP
#define NULL
Definition: c.h:229
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_DBASE_CREATE