MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
field.h
1/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2miniob is licensed under Mulan PSL v2.
3You can use this software according to the terms and conditions of the Mulan PSL v2.
4You may obtain a copy of Mulan PSL v2 at:
5 http://license.coscl.org.cn/MulanPSL2
6THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9See the Mulan PSL v2 for more details. */
10
11//
12// Created by Wangyunlai on 2022/07/05.
13//
14
15#pragma once
16
17#include "storage/field/field_meta.h"
18#include "storage/table/table.h"
19
24class Field
25{
26public:
27 Field() = default;
28 Field(const Table *table, const FieldMeta *field) : table_(table), field_(field) {}
29 Field(const Field &) = default;
30
31 const Table *table() const { return table_; }
32 const FieldMeta *meta() const { return field_; }
33
34 AttrType attr_type() const { return field_->type(); }
35
36 const char *table_name() const { return table_->name(); }
37 const char *field_name() const { return field_->name(); }
38
39 void set_table(const Table *table) { this->table_ = table; }
40 void set_field(const FieldMeta *field) { this->field_ = field; }
41
42 void set_int(Record &record, int value);
43 int get_int(const Record &record);
44
45 const char *get_data(const Record &record);
46
47private:
48 const Table *table_ = nullptr;
49 const FieldMeta *field_ = nullptr;
50};
字段元数据
Definition: field_meta.h:30
字段
Definition: field.h:25
表示一个记录
Definition: record.h:101
Definition: table.h:42