Info API::DropIndex(SqlCommandDropIndex* command){ CatalogManager catalog_manager; IndexManager index_manager; std::string index_name = command->index_name(); if (!catalog_manager.HasIndex(index_name)){ std::string error_info; error_info = "Index \"" + index_name + "\" not exists."; return Info(error_info); } else{ IndexInfo index = catalog_manager.GetIndexInfo(index_name); std::string table_name = index.table_name(); std::string attribute_name = index.attribute_name(); index_manager.EmptyIndex(index); if (catalog_manager.DropIndex(index_name)){ //update table info TableInfo table = catalog_manager.GetTableInfo(table_name); table.remove_index(attribute_name,index_name); catalog_manager.WriteTableInfo(table); return Info(); } else{ return Info("Drop index Failed"); } } }