taco-db  0.1.0
Table.h
Go to the documentation of this file.
1 
7 #ifndef CATALOG_SYSTABLES_Table_H
8 #define CATALOG_SYSTABLES_Table_H
9 
10 namespace taco {
11 
17 public:
18 
22  constexpr Oid
23  tabid() const {
24  return m_tabid;
25  }
26 
30  constexpr bool
31  tabissys() const {
32  return m_tabissys;
33  }
34 
38  constexpr bool
39  tabisvarlen() const {
40  return m_tabisvarlen;
41  }
42 
46  constexpr int16_t
47  tabncols() const {
48  return m_tabncols;
49  }
50 
54  constexpr uint32_t
55  tabfid() const {
56  return m_tabfid;
57  }
58 
62  constexpr const std::string&
63  tabname() const {
64  return m_tabname;
65  }
66 
67 
68 
69 private:
71  Oid tabid,
72  bool tabissys,
73  bool tabisvarlen,
74  int16_t tabncols,
75  uint32_t tabfid,
76  std::string tabname
77 
78  ):
79  m_tabid((tabid)),
83  m_tabfid((tabfid)),
84  m_tabname(std::move(tabname))
85 {}
86 
88  bool m_tabissys;
90  int16_t m_tabncols;
91  uint32_t m_tabfid;
92  std::string m_tabname;
93 
100  std::vector<Datum> GetDatumVector() const;
101 
107  static SysTable_Table *Create(const std::vector<Datum>&);
108 
109  SysTable_Table(const SysTable_Table&) = default;
111 
112  friend class BootstrapCatCache;
114 
115 public:
116  // The following are constants of the field ids in the systables.
117  // These are mostly used by the catalog cache impl. to prevent accidental
118  // misspelling of column names.
119 
120  inline static constexpr FieldId
122  return 0;
123  }
124 
125  inline static constexpr FieldId
127  return 1;
128  }
129 
130  inline static constexpr FieldId
132  return 2;
133  }
134 
135  inline static constexpr FieldId
137  return 3;
138  }
139 
140  inline static constexpr FieldId
142  return 4;
143  }
144 
145  inline static constexpr FieldId
147  return 5;
148  }
149 
150 
151 };
152 
153 } // namespace taco
154 
155 #endif // CATALOG_SYSTABLES_Table_H
156 
BootstrapCatCache stores hard-coded data needed to bootstrap the entire database catalog.
Definition: BootstrapCatCache.h:21
Some internal functions of catalog cache implementations.
Definition: CatCacheBase.h:38
SysTable_Table is an in-memory cached record in the system catalog SysTable_Table.
Definition: Table.h:16
static constexpr FieldId tabissys_colid()
Definition: Table.h:126
std::vector< Datum > GetDatumVector() const
Returns all the fields as a datum vector.
Definition: Table.cpp:37
constexpr Oid tabid() const
Returns the table ID.
Definition: Table.h:23
SysTable_Table(Oid tabid, bool tabissys, bool tabisvarlen, int16_t tabncols, uint32_t tabfid, std::string tabname)
Definition: Table.h:70
bool m_tabissys
Definition: Table.h:88
static SysTable_Table * Create(const std::vector< Datum > &)
Creates a new SysTable_Table with a data vector read from some record payload.
Definition: Table.cpp:17
SysTable_Table(const SysTable_Table &)=default
static constexpr FieldId tabisvarlen_colid()
Definition: Table.h:131
std::string m_tabname
Definition: Table.h:92
uint32_t m_tabfid
Definition: Table.h:91
static constexpr FieldId tabfid_colid()
Definition: Table.h:141
Oid m_tabid
Definition: Table.h:87
constexpr bool tabisvarlen() const
Returns whether this table is stored as a variable-length heap file.
Definition: Table.h:39
constexpr bool tabissys() const
Returns whether this table is a catalog table.
Definition: Table.h:31
static constexpr FieldId tabid_colid()
Definition: Table.h:121
static constexpr FieldId tabname_colid()
Definition: Table.h:146
constexpr uint32_t tabfid() const
Returns the file ID of the heap file of the table.
Definition: Table.h:55
SysTable_Table & operator=(const SysTable_Table &)=default
bool m_tabisvarlen
Definition: Table.h:89
constexpr const std::string & tabname() const
Returns the table name.
Definition: Table.h:63
constexpr int16_t tabncols() const
Returns the number of columns.
Definition: Table.h:47
int16_t m_tabncols
Definition: Table.h:90
static constexpr FieldId tabncols_colid()
Definition: Table.h:136
Definition: Record.h:148
Definition: datum.h:28
uint32_t Oid
Definition: tdb_base.h:210
int16_t FieldId
Definition: tdb_base.h:212