some code refactoring

This commit is contained in:
2021-12-18 10:53:43 +01:00
parent d645471c15
commit 7e8d750f63
7 changed files with 76 additions and 83 deletions

View File

@@ -27,15 +27,7 @@ std::unique_ptr<Table> USql::execute_create_index(const CreateIndexNode &node) {
if (col_def.null) throw Exception("index on not null supported only");
if (table_def->get_index_for_column(node.column_name) != nullptr) throw Exception("column is already indexed");
IndexedDataType type;
if (col_def.type == ColumnType::integer_type)
type = IndexedDataType::integer;
else if (col_def.type == ColumnType::varchar_type)
type = IndexedDataType::string;
else
throw Exception("creating index on unsupported type");
table_def->create_index({node.index_name, node.column_name, type});
table_def->create_index({node.index_name, node.column_name, col_def.type});
table_def->index_rows(node.index_name);