MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
sql_result.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/11/17.
13//
14
15#pragma once
16
17#include <string>
18#include <memory>
19
20#include "sql/expr/tuple.h"
21#include "sql/operator/physical_operator.h"
22
23class Session;
24
33{
34public:
35 SqlResult(Session *session);
37 {}
38
39 void set_tuple_schema(const TupleSchema &schema);
40 void set_return_code(RC rc)
41 {
42 return_code_ = rc;
43 }
44 void set_state_string(const std::string &state_string)
45 {
46 state_string_ = state_string;
47 }
48
49 void set_operator(std::unique_ptr<PhysicalOperator> oper);
50
51 bool has_operator() const
52 {
53 return operator_ != nullptr;
54 }
55 const TupleSchema &tuple_schema() const
56 {
57 return tuple_schema_;
58 }
59 RC return_code() const
60 {
61 return return_code_;
62 }
63 const std::string &state_string() const
64 {
65 return state_string_;
66 }
67
68 RC open();
69 RC close();
70 RC next_tuple(Tuple *&tuple);
71
72private:
73 Session *session_ = nullptr;
74 std::unique_ptr<PhysicalOperator> operator_;
76 RC return_code_ = RC::SUCCESS;
77 std::string state_string_;
78};
表示会话
Definition: session.h:28
SQL执行结果
Definition: sql_result.h:33
Session * session_
当前所属会话
Definition: sql_result.h:73
TupleSchema tuple_schema_
返回的表头信息。可能有也可能没有
Definition: sql_result.h:75
std::unique_ptr< PhysicalOperator > operator_
执行计划
Definition: sql_result.h:74
元组的结构,包含哪些字段(这里成为Cell),每个字段的说明
Definition: tuple.h:52
元组的抽象描述
Definition: tuple.h:84