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/table/table.h"
18#include "storage/field/field_meta.h"
19
24class Field
25{
26public:
27 Field() = default;
28 Field(const Table *table, const FieldMeta *field) : table_(table), field_(field)
29 {}
30 Field(const Field &) = default;
31
32 const Table *table() const
33 {
34 return table_;
35 }
36 const FieldMeta *meta() const
37 {
38 return field_;
39 }
40
41 AttrType attr_type() const
42 {
43 return field_->type();
44 }
45
46 const char *table_name() const
47 {
48 return table_->name();
49 }
50 const char *field_name() const
51 {
52 return field_->name();
53 }
54
55 void set_table(const Table *table)
56 {
57 this->table_ = table;
58 }
59 void set_field(const FieldMeta *field)
60 {
61 this->field_ = field;
62 }
63
64 void set_int(Record &record, int value);
65 int get_int(const Record &record);
66
67 const char *get_data(const Record &record);
68
69private:
70 const Table *table_ = nullptr;
71 const FieldMeta *field_ = nullptr;
72};
字段元数据
Definition: field_meta.h:31
字段
Definition: field.h:25
表示一个记录 当前的记录都是连续存放的空间(内存或磁盘上)。 为了提高访问的效率,record通常直接记录指向页面上的内存,但是需要保证访问这种数据时,拿着锁资源。 为了方便,也提供了复制内存的方法。可...
Definition: record.h:92
Definition: table.h:37