MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
create_table_stmt.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 2023/6/13.
13//
14
15#pragma once
16
17#include <string>
18#include <vector>
19
20#include "sql/stmt/stmt.h"
21
22class Db;
23
29class CreateTableStmt : public Stmt
30{
31public:
32 CreateTableStmt(const std::string &table_name, const std::vector<AttrInfoSqlNode> &attr_infos)
33 : table_name_(table_name),
34 attr_infos_(attr_infos)
35 {}
36 virtual ~CreateTableStmt() = default;
37
38 StmtType type() const override { return StmtType::CREATE_TABLE; }
39
40 const std::string &table_name() const { return table_name_; }
41 const std::vector<AttrInfoSqlNode> &attr_infos() const { return attr_infos_; }
42
43 static RC create(Db *db, const CreateTableSqlNode &create_table, Stmt *&stmt);
44
45private:
46 std::string table_name_;
47 std::vector<AttrInfoSqlNode> attr_infos_;
48};
表示创建表的语句
Definition: create_table_stmt.h:30
一个DB实例负责管理一批表
Definition: db.h:34
Stmt for Statement
Definition: stmt.h:78
描述一个create table语句
Definition: parse_defs.h:161