diff --git a/src/observer/sql/stmt/delete_stmt.cpp b/src/observer/sql/stmt/delete_stmt.cpp index 114e4f85ce7a6fa9f708cf024fc72382c0e6de69..452f0be13fa7bfbaf404cb07062e61428d6c4b75 100644 --- a/src/observer/sql/stmt/delete_stmt.cpp +++ b/src/observer/sql/stmt/delete_stmt.cpp @@ -46,7 +46,7 @@ RC DeleteStmt::create(Db *db, const Deletes &delete_sql, Stmt *&stmt) return RC::SCHEMA_TABLE_NOT_EXIST; } - std::unordered_map table_map; + std::unordered_map table_map; table_map.insert(std::pair(std::string_view(table_name), table)); FilterStmt *filter_stmt = nullptr; diff --git a/src/observer/sql/stmt/filter_stmt.cpp b/src/observer/sql/stmt/filter_stmt.cpp index cbc4ece824a8e964152335e0ffd5e2676beee314..19d3b58edae6c18b7c33fe3f4f28b7a688b4eca9 100644 --- a/src/observer/sql/stmt/filter_stmt.cpp +++ b/src/observer/sql/stmt/filter_stmt.cpp @@ -27,7 +27,7 @@ FilterStmt::~FilterStmt() filter_units_.clear(); } -RC FilterStmt::create(Db *db, Table *default_table, std::unordered_map *tables, +RC FilterStmt::create(Db *db, Table *default_table, std::unordered_map *tables, const Condition *conditions, int condition_num, FilterStmt *&stmt) { @@ -50,13 +50,13 @@ RC FilterStmt::create(Db *db, Table *default_table, std::unordered_map *tables, +RC get_table_and_field(Db *db, Table *default_table, std::unordered_map *tables, const RelAttr &attr, Table *&table, const FieldMeta *&field) { if (common::is_blank(attr.relation_name)) { table = default_table; } else if (nullptr != tables) { - auto iter = tables->find(std::string_view(attr.relation_name)); + auto iter = tables->find(std::string(attr.relation_name)); if (iter != tables->end()) { table = iter->second; } @@ -78,7 +78,7 @@ RC get_table_and_field(Db *db, Table *default_table, std::unordered_map *tables, +RC FilterStmt::create_filter_unit(Db *db, Table *default_table, std::unordered_map *tables, const Condition &condition, FilterUnit *&filter_unit) { RC rc = RC::SUCCESS; diff --git a/src/observer/sql/stmt/filter_stmt.h b/src/observer/sql/stmt/filter_stmt.h index b5c6f64572e4abca6094845544ffdc4eae7d6ba5..518e4d7b245b47b754b0f6efef6f78d9485eb041 100644 --- a/src/observer/sql/stmt/filter_stmt.h +++ b/src/observer/sql/stmt/filter_stmt.h @@ -86,11 +86,11 @@ public: } public: - static RC create(Db *db, Table *default_table, std::unordered_map *tables, + static RC create(Db *db, Table *default_table, std::unordered_map *tables, const Condition *conditions, int condition_num, FilterStmt *&stmt); - static RC create_filter_unit(Db *db, Table *default_table, std::unordered_map *tables, + static RC create_filter_unit(Db *db, Table *default_table, std::unordered_map *tables, const Condition &condition, FilterUnit *&filter_unit); private: diff --git a/src/observer/sql/stmt/select_stmt.cpp b/src/observer/sql/stmt/select_stmt.cpp index a8eca8204142f6fbabd1a5e54f1bddc044d6fe89..aa56ea5b39a016850c218bb3cc188dac7551c68b 100644 --- a/src/observer/sql/stmt/select_stmt.cpp +++ b/src/observer/sql/stmt/select_stmt.cpp @@ -45,7 +45,7 @@ RC SelectStmt::create(Db *db, const Selects &select_sql, Stmt *&stmt) // collect tables in `from` statement std::vector tables; - std::unordered_map table_map; + std::unordered_map table_map; for (int i = 0; i < select_sql.relation_num; i++) { const char *table_name = select_sql.relations[i]; if (nullptr == table_name) { diff --git a/src/observer/storage/common/record.h b/src/observer/storage/common/record.h index 963a37147c8a942d7389a6325ccf3807e040b7b9..28c6faf0397ad81956371b5079cbcec16b382f6c 100644 --- a/src/observer/storage/common/record.h +++ b/src/observer/storage/common/record.h @@ -16,6 +16,7 @@ See the Mulan PSL v2 for more details. */ #include #include +#include #include #include "rc.h" diff --git a/src/observer/storage/default/default_storage_stage.cpp b/src/observer/storage/default/default_storage_stage.cpp index 5fb941321dca2ab3be5868312c5c5fae8b060525..d59334d97d759107afe23f2ace0d3cb3034a6a96 100644 --- a/src/observer/storage/default/default_storage_stage.cpp +++ b/src/observer/storage/default/default_storage_stage.cpp @@ -158,40 +158,6 @@ void DefaultStorageStage::handle_event(StageEvent *event) char response[256]; switch (sql->flag) { - case SCF_INSERT: { // insert into - const Inserts &inserts = sql->sstr.insertion; - const char *table_name = inserts.relation_name; - //rc = handler_->insert_record(current_trx, current_db, table_name, inserts.value_num, inserts.values); - snprintf(response, sizeof(response), "%s\n", rc == RC::SUCCESS ? "SUCCESS" : "FAILURE"); - } break; - case SCF_UPDATE: { - const Updates &updates = sql->sstr.update; - const char *table_name = updates.relation_name; - const char *field_name = updates.attribute_name; - int updated_count = 0; - #if 0 - rc = handler_->update_record(current_trx, - current_db, - table_name, - field_name, - &updates.value, - updates.condition_num, - updates.conditions, - &updated_count); - #endif - snprintf(response, sizeof(response), "%s\n", rc == RC::SUCCESS ? "SUCCESS" : "FAILURE"); - } break; - case SCF_DELETE: { - const Deletes &deletes = sql->sstr.deletion; - const char *table_name = deletes.relation_name; - int deleted_count = 0; - #if 0 - rc = handler_->delete_record( - current_trx, current_db, table_name, deletes.condition_num, deletes.conditions, &deleted_count); - #endif - snprintf(response, sizeof(response), "%s\n", rc == RC::SUCCESS ? "SUCCESS" : "FAILURE"); - } break; - case SCF_LOAD_DATA: { /* 从文件导入数据,如果做性能测试,需要保持这些代码可以正常工作