tinySQL  0.1
A self-contained database management system
All Classes Files Functions Variables Pages
exec_engine.h
Go to the documentation of this file.
1 
11 #ifndef EXEC_ENGINE_H
12 #define EXEC_ENGINE_H
13 
14 #include "share/data_t.h"
15 #include "hsql/SQLParser.h"
16 #include "catalog/catalog.h"
17 #include "record/record_manager.h"
18 
24 public:
25  Exec_Engine():index_manager(&bfm), catalog_manager(&bfm) ,record_manager(&bfm, &catalog_manager, &index_manager){};
26 
33  void createTable(std::string &table_name, Attribute &attr);
34 
40  void dropTable(std::string &table_name);
41 
50  void selectRecord(std::string &table_name, std::vector<std::string>& attr_names, std::vector<Where>& wheres, std::vector<MemoryTuple>& result); //recordManager
51 
58  void insertRecord(std::string &table_name, MemoryTuple &row);
59 
67  void createIndex(std::string &table_name, std::string &index_name, std::string &attr_name); //index_manager
68 
74  void dropIndex(std::string &index_name);
75 
82  void deleteRecord(std::string &table_name, std::vector<Where>& data);
83 
90  void updateRecord(std::string &table_name, std::vector<Where>& data);
91 
98  Attribute getTableAttributes(const std::string &table_name);
99 
104  void showTables(){
105  catalog_manager.ShowAllTable();
106  }
107 
108 private:
109  BufferManager bfm;
110  RecordManager record_manager;
111  CatalogManager catalog_manager;
112  IndexManager index_manager;
113 };
114 
115 #endif
record_manager.h
CatalogManager
Manage all the table names, attritbutes, and index existence.
Definition: catalog.h:30
Exec_Engine::updateRecord
void updateRecord(std::string &table_name, std::vector< Where > &data)
Update a record based on conditions.
Exec_Engine::deleteRecord
void deleteRecord(std::string &table_name, std::vector< Where > &data)
Delete records by conditions.
Definition: exec_engine.cpp:27
Exec_Engine::showTables
void showTables()
display the information of all the tables
Definition: exec_engine.h:104
BufferManager
Buffer manager is an abstraction of memory on computer for modules at higher level.
Definition: buffer_manager.h:69
Exec_Engine::createTable
void createTable(std::string &table_name, Attribute &attr)
Create a Table.
Definition: exec_engine.cpp:4
IndexManager
Manage index files.
Definition: Index.h:15
Exec_Engine::selectRecord
void selectRecord(std::string &table_name, std::vector< std::string > &attr_names, std::vector< Where > &wheres, std::vector< MemoryTuple > &result)
Select records by conditions.
Definition: exec_engine.cpp:31
Exec_Engine::getTableAttributes
Attribute getTableAttributes(const std::string &table_name)
Get the Table Attributes.
Definition: exec_engine.cpp:51
RecordManager
The class manages the table's data.
Definition: record_manager.h:63
Exec_Engine::createIndex
void createIndex(std::string &table_name, std::string &index_name, std::string &attr_name)
Create Index on a table's attribute.
Definition: exec_engine.cpp:14
Exec_Engine::dropTable
void dropTable(std::string &table_name)
Delete a Table.
Definition: exec_engine.cpp:9
Exec_Engine
Execute commands from the interface.
Definition: exec_engine.h:23
Exec_Engine::dropIndex
void dropIndex(std::string &index_name)
Delete the index of a certain index on a table.
Definition: exec_engine.cpp:20
Attribute
The attributes for a schema.
Definition: data_t.h:172
Exec_Engine::insertRecord
void insertRecord(std::string &table_name, MemoryTuple &row)
Insert a piece of record.
Definition: exec_engine.cpp:55