MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
char_type.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#pragma once
12
13#include "common/sys/rc.h"
14#include "common/type/data_type.h"
15
20class CharType : public DataType
21{
22public:
23 CharType() : DataType(AttrType::CHARS) {}
24
25 virtual ~CharType() = default;
26
27 int compare(const Value &left, const Value &right) const override;
28
29 RC cast_to(const Value &val, AttrType type, Value &result) const override;
30
31 RC set_value_from_str(Value &val, const string &data) const override;
32
33 int cast_cost(AttrType type) override;
34
35 RC to_string(const Value &val, string &result) const override;
36};
固定长度的字符串类型
Definition: char_type.h:21
int cast_cost(AttrType type) override
计算从 type 到 attr_type 的隐式转换的 cost,如果无法转换,返回 INT32_MAX
Definition: char_type.cpp:37
int compare(const Value &left, const Value &right) const override
Definition: char_type.cpp:16
RC to_string(const Value &val, string &result) const override
将 val 转换为 string,并将结果保存到 result 中
Definition: char_type.cpp:45
RC cast_to(const Value &val, AttrType type, Value &result) const override
将 val 转换为 type 类型,并将结果保存到 result 中
Definition: char_type.cpp:29
Definition: data_type.h:28
属性的值
Definition: value.h:30