Skip to content

Commit 291eb33

Browse files
authoredJun 27, 2023
### What problem were solved in this pull request? Issue Number: close oceanbase#191 Problem: doxy文档的首页没有描述 ### What is changed and how it works? 增加首页描述信息,写在了main.cpp中 ### Other information
1 parent f4e5213 commit 291eb33

18 files changed

+189
-72
lines changed
 

‎src/observer/main.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,11 @@ int main(int argc, char **argv)
189189

190190
delete g_server;
191191
}
192+
193+
/**
194+
* @mainpage MiniOB
195+
*
196+
* MiniOB 是 OceanBase 与华中科技大学联合开发的、面向"零"基础同学的数据库入门学习项目。
197+
*
198+
* MiniOB 设计的目标是面向在校学生、数据库从业者、爱好者,或者对基础技术有兴趣的爱好者, 整体代码量少,易于上手并学习, 是一个系统性的数据库学习项目。miniob 设置了一系列由浅入深的题目,以帮助同学们"零"基础入门, 让同学们快速了解数据库并深入学习数据库内核,期望通过相关训练之后,能够熟练掌握数据库内核模块的功能与协同关系, 并能够在使用数据库时,设计出高效的 SQL 。miniob 为了更好的学习数据库实现原理, 对诸多模块都做了简化,比如不考虑并发操作, 安全特性, 复杂的事物管理等功能。
199+
*/

‎src/observer/sql/executor/command_executor.h

+8
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ See the Mulan PSL v2 for more details. */
1818

1919
class SQLStageEvent;
2020

21+
/**
22+
* @defgroup Executor
23+
* @brief 一些SQL语句不会生成对应的执行计划,直接使用Executor来执行,比如DDL语句
24+
*/
2125

26+
/**
27+
* @brief 执行器
28+
* @ingroup Executor
29+
*/
2230
class CommandExecutor
2331
{
2432
public:

‎src/observer/sql/executor/create_index_executor.h

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ See the Mulan PSL v2 for more details. */
1818

1919
class SQLStageEvent;
2020

21+
/**
22+
* @brief 创建索引的执行器
23+
* @ingroup Executor
24+
* @note 创建索引时不能做其它操作。MiniOB当前不完善,没有对一些并发做控制,包括schema的并发。
25+
*/
2126
class CreateIndexExecutor
2227
{
2328
public:

‎src/observer/sql/executor/create_table_executor.h

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ See the Mulan PSL v2 for more details. */
1818

1919
class SQLStageEvent;
2020

21+
/**
22+
* @brief 创建表的执行器
23+
* @ingroup Executor
24+
*/
2125
class CreateTableExecutor
2226
{
2327
public:

‎src/observer/sql/executor/desc_table_executor.h

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ See the Mulan PSL v2 for more details. */
1818

1919
class SQLStageEvent;
2020

21+
/**
22+
* @brief 描述表的执行器
23+
* @ingroup Executor
24+
*/
2125
class DescTableExecutor
2226
{
2327
public:

‎src/observer/sql/executor/help_executor.h

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ See the Mulan PSL v2 for more details. */
2121
#include "sql/executor/sql_result.h"
2222
#include "session/session.h"
2323

24+
/**
25+
* @brief Help语句执行器
26+
* @ingroup Executor
27+
*/
2428
class HelpExecutor
2529
{
2630
public:

‎src/observer/sql/executor/show_tables_executor.h

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ See the Mulan PSL v2 for more details. */
2222
#include "session/session.h"
2323
#include "storage/db/db.h"
2424

25+
/**
26+
* @brief 显示所有表的执行器
27+
* @ingroup Executor
28+
* @note 与CreateIndex类似,不处理并发
29+
*/
2530
class ShowTablesExecutor
2631
{
2732
public:

‎src/observer/sql/executor/sql_result.h

+9-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ See the Mulan PSL v2 for more details. */
2222

2323
class Session;
2424

25+
/**
26+
* @brief SQL执行结果
27+
* @details 如果当前SQL生成了执行计划,那么在返回客户端时,调用执行计划返回结果。
28+
* 否则返回的结果就是当前SQL的执行结果,比如DDL语句,通过return_code和state_string来描述。
29+
* 如果出现了一些错误,也可以通过return_code和state_string来获取信息。
30+
*/
2531
class SqlResult
2632
{
2733
public:
@@ -63,9 +69,9 @@ class SqlResult
6369
RC next_tuple(Tuple *&tuple);
6470

6571
private:
66-
Session *session_ = nullptr;
67-
std::unique_ptr<PhysicalOperator> operator_;
68-
TupleSchema tuple_schema_;
72+
Session *session_ = nullptr; ///< 当前所属会话
73+
std::unique_ptr<PhysicalOperator> operator_; ///< 执行计划
74+
TupleSchema tuple_schema_; ///< 返回的表头信息。可能有也可能没有
6975
RC return_code_ = RC::SUCCESS;
7076
std::string state_string_;
7177
};

‎src/observer/sql/executor/trx_begin_executor.h

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ See the Mulan PSL v2 for more details. */
2222
#include "session/session.h"
2323
#include "storage/trx/trx.h"
2424

25+
/**
26+
* @brief 事务开始语句的执行器
27+
* @ingroup Executor
28+
*/
2529
class TrxBeginExecutor
2630
{
2731
public:

‎src/observer/sql/executor/trx_end_executor.h

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ See the Mulan PSL v2 for more details. */
2222
#include "storage/trx/trx.h"
2323
#include "sql/stmt/stmt.h"
2424

25+
/**
26+
* @brief 事务结束的执行器,可以是提交或回滚
27+
* @ingroup Executor
28+
*/
2529
class TrxEndExecutor
2630
{
2731
public:

‎src/observer/sql/expr/expression.h

+39-10
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,29 @@ See the Mulan PSL v2 for more details. */
2222

2323
class Tuple;
2424

25+
/**
26+
* @defgroup Expression
27+
* @brief 表达式
28+
*/
29+
30+
/**
31+
* @brief 表达式类型
32+
* @ingroup Expression
33+
*/
2534
enum class ExprType
2635
{
2736
NONE,
28-
FIELD,
29-
VALUE,
30-
CAST,
31-
COMPARISON,
32-
CONJUNCTION,
37+
FIELD, ///< 字段。在实际执行时,根据行数据内容提取对应字段的值
38+
VALUE, ///< 常量值
39+
CAST, ///< 需要做类型转换的表达式
40+
COMPARISON, ///< 需要做比较的表达式
41+
CONJUNCTION, ///< 多个表达式使用同一种关系(AND或OR)来联结
3342
};
3443

3544
/**
36-
* 表达式的抽象描述
37-
* 在SQL的元素中,任何需要得出值的元素都可以使用表达式来描述
45+
* @brief 表达式的抽象描述
46+
* @ingroup Expression
47+
* @details 在SQL的元素中,任何需要得出值的元素都可以使用表达式来描述
3848
* 比如获取某个字段的值、比较运算、类型转换
3949
* 当然还有一些当前没有实现的表达式,比如算术运算。
4050
*
@@ -49,22 +59,27 @@ class Expression
4959
virtual ~Expression() = default;
5060

5161
/**
52-
* 根据具体的tuple,来计算当前表达式的值
62+
* @brief 根据具体的tuple,来计算当前表达式的值。tuple有可能是一个具体某个表的行数据
5363
*/
5464
virtual RC get_value(const Tuple &tuple, TupleCell &cell) const = 0;
5565

5666
/**
57-
* 表达式的类型
67+
* @brief 表达式的类型
5868
* 可以根据表达式类型来转换为具体的子类
5969
*/
6070
virtual ExprType type() const = 0;
6171

6272
/**
63-
* 表达式值的类型
73+
* @brief 表达式值的类型
74+
* @details 一个表达式运算出结果后,只有一个值
6475
*/
6576
virtual AttrType value_type() const = 0;
6677
};
6778

79+
/**
80+
* @brief 字段表达式
81+
* @ingroup Expression
82+
*/
6883
class FieldExpr : public Expression
6984
{
7085
public:
@@ -111,6 +126,10 @@ class FieldExpr : public Expression
111126
Field field_;
112127
};
113128

129+
/**
130+
* @brief 常量值表达式
131+
* @ingroup Expression
132+
*/
114133
class ValueExpr : public Expression
115134
{
116135
public:
@@ -166,6 +185,10 @@ class ValueExpr : public Expression
166185
TupleCell tuple_cell_;
167186
};
168187

188+
/**
189+
* @brief 类型转换表达式
190+
* @ingroup Expression
191+
*/
169192
class CastExpr : public Expression
170193
{
171194
public:
@@ -192,6 +215,10 @@ class CastExpr : public Expression
192215
AttrType cast_type_;
193216
};
194217

218+
/**
219+
* @brief 比较表达式
220+
* @ingroup Expression
221+
*/
195222
class ComparisonExpr : public Expression
196223
{
197224
public:
@@ -240,6 +267,8 @@ class ComparisonExpr : public Expression
240267
};
241268

242269
/**
270+
* @brief 联结表达式
271+
* @ingroup Expression
243272
* 多个表达式使用同一种关系(AND或OR)来联结
244273
* 当前miniob仅有AND操作
245274
*/

‎src/observer/sql/expr/tuple_cell.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ See the Mulan PSL v2 for more details. */
1818
#include "storage/table/table.h"
1919
#include "storage/field/field_meta.h"
2020

21-
class TupleCellSpec {
21+
class TupleCellSpec
22+
{
2223
public:
2324
TupleCellSpec(const char *table_name, const char *field_name, const char *alias = nullptr);
2425
TupleCellSpec(const char *alias);

‎src/observer/sql/parser/parse_defs.h

+24-24
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ enum CompOp
5252
enum AttrType
5353
{
5454
UNDEFINED,
55-
CHARS, /// 字符串类型
56-
INTS, /// 整数类型(4字节)
57-
FLOATS, /// 浮点数类型(4字节)
58-
BOOLEANS, /// boolean类型,当前不是由parser解析出来的,是程序内部使用的
55+
CHARS, ///< 字符串类型
56+
INTS, ///< 整数类型(4字节)
57+
FLOATS, ///< 浮点数类型(4字节)
58+
BOOLEANS, ///< boolean类型,当前不是由parser解析出来的,是程序内部使用的
5959
};
6060

6161
/**
@@ -64,14 +64,14 @@ enum AttrType
6464
*/
6565
struct Value
6666
{
67-
AttrType type; /// 属性的类型
68-
int int_value; /// 如果是整数,这个值就有意义
69-
float float_value; /// 如果是浮点数,这个值就有意义
70-
bool bool_value; /// 如果是boolean值,这个值就有意义
71-
std::string string_value; /// 如果是字符串,这个值就有意义
67+
AttrType type; ///< 属性的类型
68+
int int_value; ///< 如果是整数,这个值就有意义
69+
float float_value; ///< 如果是浮点数,这个值就有意义
70+
bool bool_value; ///< 如果是boolean值,这个值就有意义
71+
std::string string_value; ///< 如果是字符串,这个值就有意义
7272

73-
const char *data() const; /// 获取值的内存地址
74-
int length(); /// 获取占用的内存长度
73+
const char *data() const; ///< 获取值的内存地址
74+
int length(); ///< 获取占用的内存长度
7575
};
7676

7777
/**
@@ -105,9 +105,9 @@ struct Condition
105105
*/
106106
struct Selects
107107
{
108-
std::vector<RelAttr> attributes; /// attributes in select clause
109-
std::vector<std::string> relations; /// 查询的表
110-
std::vector<Condition> conditions; /// 查询条件,使用AND串联起来多个条件
108+
std::vector<RelAttr> attributes; ///< attributes in select clause
109+
std::vector<std::string> relations; ///< 查询的表
110+
std::vector<Condition> conditions; ///< 查询条件,使用AND串联起来多个条件
111111
};
112112

113113
/**
@@ -116,8 +116,8 @@ struct Selects
116116
*/
117117
struct Inserts
118118
{
119-
std::string relation_name; /// Relation to insert into
120-
std::vector<Value> values; /// 要插入的值
119+
std::string relation_name; ///< Relation to insert into
120+
std::vector<Value> values; ///< 要插入的值
121121
};
122122

123123
/**
@@ -135,9 +135,9 @@ struct Deletes
135135
*/
136136
struct Updates
137137
{
138-
std::string relation_name; // Relation to update
139-
std::string attribute_name; /// 更新的字段,仅支持一个字段
140-
Value value; /// 更新的值,仅支持一个字段
138+
std::string relation_name; ///< Relation to update
139+
std::string attribute_name; ///< 更新的字段,仅支持一个字段
140+
Value value; ///< 更新的值,仅支持一个字段
141141
std::vector<Condition> conditions;
142142
};
143143

@@ -149,9 +149,9 @@ struct Updates
149149
*/
150150
struct AttrInfo
151151
{
152-
AttrType type; /// Type of attribute
153-
std::string name; /// Attribute name
154-
size_t length; /// Length of attribute
152+
AttrType type; ///< Type of attribute
153+
std::string name; ///< Attribute name
154+
size_t length; ///< Length of attribute
155155
};
156156

157157
/**
@@ -191,8 +191,8 @@ struct CreateIndex
191191
*/
192192
struct DropIndex
193193
{
194-
std::string index_name; // Index name
195-
std::string relation_name; // Relation name
194+
std::string index_name; ///< Index name
195+
std::string relation_name; ///< Relation name
196196
};
197197

198198
/**

0 commit comments

Comments
 (0)
Please sign in to comment.