Column-oriented GPU-accelerated Database Management System
CoGaDB
|
00001 #pragma once 00002 #include <core/global_definitions.hpp> 00003 #include <core/base_table.hpp> 00004 namespace CoGaDB{ 00005 00006 00007 class DataDictionary{ 00008 public: 00009 //returns a list of all columns with name column_name, toghether with their corresponding tables 00010 std::list<std::pair<ColumnPtr,TablePtr> > getColumnsforColumnName(const std::string& column_name); 00011 /*\brief 00012 \result result stored in variable the reference type points to in case function returns true, if it return false the value the reference type to is not initialized!*/ 00013 bool getAttributeType(const std::string& table_name, const std::string& column_name, AttributeType& type); 00014 static DataDictionary& instance(); 00015 00016 private: 00017 //singleton 00018 DataDictionary(); 00019 DataDictionary(const DataDictionary&); 00020 DataDictionary& operator=(DataDictionary&); 00021 00022 }; 00023 /* 00024 DataDictionary& DataDictionary::instance(){ 00025 static DataDictionary dd; 00026 return dd; 00027 } 00028 00029 std::list<std::pair<ColumnPtr,TablePtr> > DataDictionary::getColumnsforColumnName(const std::string& column_name){ 00030 std::list<std::pair<ColumnPtr,TablePtr> > result; 00031 std::vector<TablePtr>& tables = CoGaDB::getGlobalTableList(); 00032 for(unsigned int i=0;i<tables.size();++i){ 00033 TableSchema schema = tables[i]->getSchema(); 00034 for(TableSchema::iterator it=schema.begin();schema.end();++it){ 00035 if(it->second==column_name){ 00036 ColumnPtr col = tables[i]->getColumnbyName(column_name); 00037 result.push_back(std::make_pair(col,tables[i])); 00038 00039 } 00040 } 00041 } 00042 return result; 00043 } 00044 00045 bool DataDictionary::getAttributeType(const std::string& table_name, const std::string& column_name, AttributeType& result_attribute_type){ 00046 std::vector<TablePtr>& tables = CoGaDB::getGlobalTableList(); 00047 for(unsigned int i=0;i<tables.size();++i){ 00048 TableSchema schema = tables[i]->getSchema(); 00049 for(TableSchema::iterator it=schema.begin();schema.end();++it){ 00050 if(it->second==column_name){ 00051 result_attribute_type=it->first; 00052 return true; 00053 } 00054 } 00055 } 00056 return false; 00057 } 00058 */ 00059 }; //end namespace CoGaDB 00060