taco-db  0.1.0
Column.h
Go to the documentation of this file.
1 
7 #ifndef CATALOG_SYSTABLES_Column_H
8 #define CATALOG_SYSTABLES_Column_H
9 
10 namespace taco {
11 
17 public:
18 
22  constexpr Oid
23  coltabid() const {
24  return m_coltabid;
25  }
26 
30  constexpr int16_t
31  colid() const {
32  return m_colid;
33  }
34 
38  constexpr bool
39  colisarray() const {
40  return m_colisarray;
41  }
42 
46  constexpr bool
47  colisnullable() const {
48  return m_colisnullable;
49  }
50 
54  constexpr Oid
55  coltypid() const {
56  return m_coltypid;
57  }
58 
62  constexpr uint64_t
63  coltypparam() const {
64  return m_coltypparam;
65  }
66 
70  constexpr const std::string&
71  colname() const {
72  return m_colname;
73  }
74 
75 
76 
77 private:
79  Oid coltabid,
80  int16_t colid,
81  bool colisarray,
82  bool colisnullable,
83  Oid coltypid,
84  uint64_t coltypparam,
85  std::string colname
86 
87  ):
89  m_colid((colid)),
94  m_colname(std::move(colname))
95 {}
96 
98  int16_t m_colid;
102  uint64_t m_coltypparam;
103  std::string m_colname;
104 
111  std::vector<Datum> GetDatumVector() const;
112 
118  static SysTable_Column *Create(const std::vector<Datum>&);
119 
120  SysTable_Column(const SysTable_Column&) = default;
122 
123  friend class BootstrapCatCache;
125 
126 public:
127  // The following are constants of the field ids in the systables.
128  // These are mostly used by the catalog cache impl. to prevent accidental
129  // misspelling of column names.
130 
131  inline static constexpr FieldId
133  return 0;
134  }
135 
136  inline static constexpr FieldId
138  return 1;
139  }
140 
141  inline static constexpr FieldId
143  return 2;
144  }
145 
146  inline static constexpr FieldId
148  return 3;
149  }
150 
151  inline static constexpr FieldId
153  return 4;
154  }
155 
156  inline static constexpr FieldId
158  return 5;
159  }
160 
161  inline static constexpr FieldId
163  return 6;
164  }
165 
166 
167 };
168 
169 } // namespace taco
170 
171 #endif // CATALOG_SYSTABLES_Column_H
172 
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_Column is an in-memory cached record in the system catalog SysTable_Column.
Definition: Column.h:16
static constexpr FieldId colisnullable_colid()
Definition: Column.h:147
SysTable_Column(Oid coltabid, int16_t colid, bool colisarray, bool colisnullable, Oid coltypid, uint64_t coltypparam, std::string colname)
Definition: Column.h:78
uint64_t m_coltypparam
Definition: Column.h:102
std::string m_colname
Definition: Column.h:103
static constexpr FieldId colname_colid()
Definition: Column.h:162
bool m_colisnullable
Definition: Column.h:100
int16_t m_colid
Definition: Column.h:98
bool m_colisarray
Definition: Column.h:99
constexpr Oid coltabid() const
Returns table ID.
Definition: Column.h:23
SysTable_Column(const SysTable_Column &)=default
constexpr int16_t colid() const
Returns column number (counting from 0 for ordinary columns).
Definition: Column.h:31
static constexpr FieldId colisarray_colid()
Definition: Column.h:142
Oid m_coltabid
Definition: Column.h:97
constexpr bool colisarray() const
Returns whether this is an array column.
Definition: Column.h:39
Oid m_coltypid
Definition: Column.h:101
static SysTable_Column * Create(const std::vector< Datum > &)
Creates a new SysTable_Column with a data vector read from some record payload.
Definition: Column.cpp:17
constexpr bool colisnullable() const
Returns whether this can be NULL value.
Definition: Column.h:47
constexpr const std::string & colname() const
Returns column name.
Definition: Column.h:71
static constexpr FieldId colid_colid()
Definition: Column.h:137
std::vector< Datum > GetDatumVector() const
Returns all the fields as a datum vector.
Definition: Column.cpp:39
constexpr Oid coltypid() const
Returns the type ID.
Definition: Column.h:55
constexpr uint64_t coltypparam() const
Returns the type parameter if any or 0 if there is no type parameter.
Definition: Column.h:63
SysTable_Column & operator=(const SysTable_Column &)=default
static constexpr FieldId coltypparam_colid()
Definition: Column.h:157
static constexpr FieldId coltypid_colid()
Definition: Column.h:152
static constexpr FieldId coltabid_colid()
Definition: Column.h:132
Definition: Record.h:148
Definition: datum.h:28
uint32_t Oid
Definition: tdb_base.h:210
int16_t FieldId
Definition: tdb_base.h:212