tinySQL  0.1
A self-contained database management system
All Classes Files Functions Variables Pages
Index.h
1 #ifndef INDEX_H
2 #define INDEX_H
3 
4 #include "share/data_t.h"
5 #include "share/config.h"
6 #include "share/err_type.h"
7 #include "catalog/catalog.h"
8 #include "index/bpTree_disk.h"
9 #include "buffer/buffer_manager.h"
10 
16 public:
18 
27  void CreateIndex(const std::string& indexName);
28 
37  void DropIndex(const std::string& indexName);
38 
47  void UpdateId(const std::string &indexName, const Data &key, const Index_t &new_rec_ptr);
48 
49  void UpdateKey(const std::string &indexName, const Data &key, const Data &new_key);
50 
58  void DeleteId(const std::string& indexName, const Data &key);
59 
60  bool CheckExistance(const std::string& indexName, const Data &key, Index_t &id);
70  bool FindId(const std::string& indexName, const Data &key, Index_t &result);
71 
83  bool FindId(const std::string& indexName, const Data &lower_key, const Data &upper_key, std::vector<Index_t>& result);
84 
95  void InsertId(const std::string& indexName, const Data &Key, const Index_t &rec_ptr);
96 
97 private:
98  std::string _indexName;
99  BufferManager* _bfm;
100  Bp_tree<Data, Index_t> _index_tree;
101 };
102 
103 
104 #endif
BufferManager
Buffer manager is an abstraction of memory on computer for modules at higher level.
Definition: buffer_manager.h:69
IndexManager::FindId
bool FindId(const std::string &indexName, const Data &key, Index_t &result)
Find the Index based on the key (cell)
Definition: index.cpp:69
IndexManager
Manage index files.
Definition: Index.h:15
IndexManager::DeleteId
void DeleteId(const std::string &indexName, const Data &key)
Delete an has_index of a certain key.
Definition: index.cpp:85
IndexManager::InsertId
void InsertId(const std::string &indexName, const Data &Key, const Index_t &rec_ptr)
Insert a key into the has_index table The user should make sure that the file exists....
Definition: index.cpp:26
IndexManager::DropIndex
void DropIndex(const std::string &indexName)
Drop an Index of an attr. User should make sure the table exists.
Definition: index.cpp:21
IndexManager::UpdateId
void UpdateId(const std::string &indexName, const Data &key, const Index_t &new_rec_ptr)
Update the pointer of a record in the has_index file.
Definition: index.cpp:35
Bp_tree< Data, Index_t >
IndexManager::CreateIndex
void CreateIndex(const std::string &indexName)
Create an Index of an attr. Actually creates an has_index file with a head block. File name conventio...
Definition: index.cpp:8
Data
Basic cell element in a tuples.
Definition: data_t.h:44