提交 7779cc28 编写于 作者: 羽飞's avatar 羽飞

compiled by gcc

上级 55b614bb
...@@ -46,7 +46,7 @@ RC DeleteStmt::create(Db *db, const Deletes &delete_sql, Stmt *&stmt) ...@@ -46,7 +46,7 @@ RC DeleteStmt::create(Db *db, const Deletes &delete_sql, Stmt *&stmt)
return RC::SCHEMA_TABLE_NOT_EXIST; return RC::SCHEMA_TABLE_NOT_EXIST;
} }
std::unordered_map<std::string_view, Table *> table_map; std::unordered_map<std::string, Table *> table_map;
table_map.insert(std::pair<std::string_view, Table *>(std::string_view(table_name), table)); table_map.insert(std::pair<std::string_view, Table *>(std::string_view(table_name), table));
FilterStmt *filter_stmt = nullptr; FilterStmt *filter_stmt = nullptr;
......
...@@ -27,7 +27,7 @@ FilterStmt::~FilterStmt() ...@@ -27,7 +27,7 @@ FilterStmt::~FilterStmt()
filter_units_.clear(); filter_units_.clear();
} }
RC FilterStmt::create(Db *db, Table *default_table, std::unordered_map<std::string_view, Table *> *tables, RC FilterStmt::create(Db *db, Table *default_table, std::unordered_map<std::string, Table *> *tables,
const Condition *conditions, int condition_num, const Condition *conditions, int condition_num,
FilterStmt *&stmt) FilterStmt *&stmt)
{ {
...@@ -50,13 +50,13 @@ RC FilterStmt::create(Db *db, Table *default_table, std::unordered_map<std::stri ...@@ -50,13 +50,13 @@ RC FilterStmt::create(Db *db, Table *default_table, std::unordered_map<std::stri
return rc; return rc;
} }
RC get_table_and_field(Db *db, Table *default_table, std::unordered_map<std::string_view, Table *> *tables, RC get_table_and_field(Db *db, Table *default_table, std::unordered_map<std::string, Table *> *tables,
const RelAttr &attr, Table *&table, const FieldMeta *&field) const RelAttr &attr, Table *&table, const FieldMeta *&field)
{ {
if (common::is_blank(attr.relation_name)) { if (common::is_blank(attr.relation_name)) {
table = default_table; table = default_table;
} else if (nullptr != tables) { } 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()) { if (iter != tables->end()) {
table = iter->second; table = iter->second;
} }
...@@ -78,7 +78,7 @@ RC get_table_and_field(Db *db, Table *default_table, std::unordered_map<std::str ...@@ -78,7 +78,7 @@ RC get_table_and_field(Db *db, Table *default_table, std::unordered_map<std::str
return RC::SUCCESS; return RC::SUCCESS;
} }
RC FilterStmt::create_filter_unit(Db *db, Table *default_table, std::unordered_map<std::string_view, Table *> *tables, RC FilterStmt::create_filter_unit(Db *db, Table *default_table, std::unordered_map<std::string, Table *> *tables,
const Condition &condition, FilterUnit *&filter_unit) const Condition &condition, FilterUnit *&filter_unit)
{ {
RC rc = RC::SUCCESS; RC rc = RC::SUCCESS;
......
...@@ -86,11 +86,11 @@ public: ...@@ -86,11 +86,11 @@ public:
} }
public: public:
static RC create(Db *db, Table *default_table, std::unordered_map<std::string_view, Table *> *tables, static RC create(Db *db, Table *default_table, std::unordered_map<std::string, Table *> *tables,
const Condition *conditions, int condition_num, const Condition *conditions, int condition_num,
FilterStmt *&stmt); FilterStmt *&stmt);
static RC create_filter_unit(Db *db, Table *default_table, std::unordered_map<std::string_view, Table *> *tables, static RC create_filter_unit(Db *db, Table *default_table, std::unordered_map<std::string, Table *> *tables,
const Condition &condition, FilterUnit *&filter_unit); const Condition &condition, FilterUnit *&filter_unit);
private: private:
......
...@@ -45,7 +45,7 @@ RC SelectStmt::create(Db *db, const Selects &select_sql, Stmt *&stmt) ...@@ -45,7 +45,7 @@ RC SelectStmt::create(Db *db, const Selects &select_sql, Stmt *&stmt)
// collect tables in `from` statement // collect tables in `from` statement
std::vector<Table *> tables; std::vector<Table *> tables;
std::unordered_map<std::string_view, Table *> table_map; std::unordered_map<std::string, Table *> table_map;
for (int i = 0; i < select_sql.relation_num; i++) { for (int i = 0; i < select_sql.relation_num; i++) {
const char *table_name = select_sql.relations[i]; const char *table_name = select_sql.relations[i];
if (nullptr == table_name) { if (nullptr == table_name) {
......
...@@ -16,6 +16,7 @@ See the Mulan PSL v2 for more details. */ ...@@ -16,6 +16,7 @@ See the Mulan PSL v2 for more details. */
#include <stddef.h> #include <stddef.h>
#include <vector> #include <vector>
#include <limits>
#include <sstream> #include <sstream>
#include "rc.h" #include "rc.h"
......
...@@ -158,40 +158,6 @@ void DefaultStorageStage::handle_event(StageEvent *event) ...@@ -158,40 +158,6 @@ void DefaultStorageStage::handle_event(StageEvent *event)
char response[256]; char response[256];
switch (sql->flag) { 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: { case SCF_LOAD_DATA: {
/* /*
从文件导入数据,如果做性能测试,需要保持这些代码可以正常工作 从文件导入数据,如果做性能测试,需要保持这些代码可以正常工作
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册