Skip to content

Commit ba45be8

Browse files
committed
fix: format code with clang-format
1 parent 9055d63 commit ba45be8

5 files changed

Lines changed: 25 additions & 17 deletions

File tree

src/observer/sql/executor/drop_table_executor.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
#include "common/sys/rc.h"
88

99
// ✅ 修正后 真实存在的头文件
10-
#include "event/sql_event.h" // SQLStageEvent 完整定义就在这里!
11-
#include "event/session_event.h" // SessionEvent 完整定义
12-
#include "sql/stmt/stmt.h" // Stmt 基类完整定义
10+
#include "event/sql_event.h" // SQLStageEvent 完整定义就在这里!
11+
#include "event/session_event.h" // SessionEvent 完整定义
12+
#include "sql/stmt/stmt.h" // Stmt 基类完整定义
1313

1414
RC DropTableExecutor::execute(SQLStageEvent *sql_event)
1515
{
1616
// 1. 获取 Stmt 对象
17-
Stmt *stmt = sql_event->stmt();
17+
Stmt *stmt = sql_event->stmt();
1818
DropTableStmt *drop_stmt = static_cast<DropTableStmt *>(stmt);
1919

2020
// 2. 获取当前数据库
2121
Session *session = sql_event->session_event()->session();
22-
Db *db = session->get_current_db();
22+
Db *db = session->get_current_db();
2323

2424
// 3. 调用存储层删除表
2525
return db->drop_table(drop_stmt->table_name().c_str());

src/observer/sql/executor/drop_table_executor.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
#include "common/sys/rc.h"
33

44
// 只保留前置声明,不包含任何完整头
5-
//class SQLStageEvent;
5+
// class SQLStageEvent;
66

7-
class DropTableExecutor {
7+
class DropTableExecutor
8+
{
89
public:
910
RC execute(SQLStageEvent *sql_event);
1011
};

src/observer/sql/stmt/drop_table_stmt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class DropTableStmt : public Stmt
1111
DropTableStmt(const string &table_name) : table_name_(table_name) {}
1212
virtual ~DropTableStmt() = default;
1313

14-
StmtType type() const override { return StmtType::DROP_TABLE; }
14+
StmtType type() const override { return StmtType::DROP_TABLE; }
1515
const string &table_name() const { return table_name_; }
1616

1717
static RC create(Db *db, const DropTableSqlNode &drop_table, Stmt *&stmt);

src/observer/sql/stmt/stmt.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ RC Stmt::create_stmt(Db *db, ParsedSqlNode &sql_node, Stmt *&stmt)
7777
return DescTableStmt::create(db, sql_node.desc_table, stmt);
7878
}
7979

80-
case SCF_ANALYZE_TABLE: {
80+
case SCF_ANALYZE_TABLE: {
8181
return AnalyzeTableStmt::create(db, sql_node.analyze_table, stmt);
8282
}
8383

@@ -118,8 +118,6 @@ RC Stmt::create_stmt(Db *db, ParsedSqlNode &sql_node, Stmt *&stmt)
118118
return DropTableStmt::create(db, sql_node.drop_table, stmt);
119119
}
120120

121-
default:
122-
LOG_WARN("unknown sql statement type: %d", sql_node.flag);
123-
return RC::UNIMPLEMENTED;
121+
default: LOG_WARN("unknown sql statement type: %d", sql_node.flag); return RC::UNIMPLEMENTED;
124122
}
125123
}

src/observer/storage/db/db.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ Db::~Db()
4949
LOG_INFO("Db has been closed: %s", name_.c_str());
5050
}
5151

52-
RC Db::init(const char *name, const char *dbpath, const char *trx_kit_name, const char *log_handler_name, const char *storage_engine)
52+
RC Db::init(const char *name, const char *dbpath, const char *trx_kit_name, const char *log_handler_name,
53+
const char *storage_engine)
5354
{
5455
RC rc = RC::SUCCESS;
5556

@@ -64,7 +65,7 @@ RC Db::init(const char *name, const char *dbpath, const char *trx_kit_name, cons
6465
}
6566

6667
oceanbase::ObLsmOptions options;
67-
filesystem::path lsm_path = filesystem::path(dbpath) / "lsm";
68+
filesystem::path lsm_path = filesystem::path(dbpath) / "lsm";
6869
filesystem::create_directory(lsm_path);
6970

7071
rc = oceanbase::ObLsm::open(options, lsm_path, &lsm_);
@@ -150,7 +151,8 @@ RC Db::init(const char *name, const char *dbpath, const char *trx_kit_name, cons
150151
return rc;
151152
}
152153

153-
RC Db::create_table(const char *table_name, span<const AttrInfoSqlNode> attributes, const vector<string>& primary_keys, const StorageFormat storage_format)
154+
RC Db::create_table(const char *table_name, span<const AttrInfoSqlNode> attributes, const vector<string> &primary_keys,
155+
const StorageFormat storage_format)
154156
{
155157
RC rc = RC::SUCCESS;
156158
// check table_name
@@ -163,8 +165,15 @@ RC Db::create_table(const char *table_name, span<const AttrInfoSqlNode> attribut
163165
string table_file_path = table_meta_file(path_.c_str(), table_name);
164166
Table *table = new Table();
165167
int32_t table_id = next_table_id_++;
166-
rc = table->create(this, table_id, table_file_path.c_str(), table_name, path_.c_str(), attributes, primary_keys, storage_format,
167-
get_storage_engine());
168+
rc = table->create(this,
169+
table_id,
170+
table_file_path.c_str(),
171+
table_name,
172+
path_.c_str(),
173+
attributes,
174+
primary_keys,
175+
storage_format,
176+
get_storage_engine());
168177
if (rc != RC::SUCCESS) {
169178
LOG_ERROR("Failed to create table %s.", table_name);
170179
delete table;

0 commit comments

Comments
 (0)