11 #ifndef _RECORD_MANAGER_H_ 
   12 #define _RECORD_MANAGER_H_ 
   20 #include "share/data_t.h" 
   21 #include "share/config.h" 
   22 #include "index/Index.h" 
   23 #include "catalog/catalog.h" 
   24 #include "share/err_type.h" 
   25 #include "buffer/buffer_manager.h" 
   26 #include "share/singleton.h" 
   34     db_size_t record_bytes;
 
   38         if (offset == 0) 
return tuples[0];
 
   40             if (offset >= tuple_num){
 
   44                 char* start = (
char*)tuples;
 
   45                 start = start + offset * tuples[0].getBytes();
 
   57 std::vector<Index_t> Union(
const std::vector<Index_t>& a, 
const std::vector<Index_t>& b);
 
   84     void InsertRecord(std::string table_name , 
const MemoryTuple& tuple);
 
  100     int DeleteRecord(std::string table_path, std::vector<Where> where);
 
  109     std::vector<MemoryTuple> 
SelectRecord(std::string table_name);
 
  110     std::vector<MemoryTuple> 
SelectRecord(
const std::string& table_path , 
const std::vector<std::string>& target_attr);
 
  120     std::vector<MemoryTuple> 
SelectRecord(std::string table_path , std::vector<Where> where);
 
  121     std::vector<MemoryTuple> 
SelectRecord(std::string table_name , 
const std::vector<std::string>& target_attr , std::vector<Where> where);
 
  130     void CreateIndex(std::string table_name , 
const std::string& target_attr);
 
  138     static int getBlockNum(std::string &table_name);
 
  143     bool isConflict(
const MemoryTuple &v, 
const std::string& tableName, 
int check_index);
 
  145     void searchWithIndex(std::string &table_name , std::string &target_attr , 
const Where& where , std::vector<Index_t>& record_ids);
 
  149     int conditionDeleteInBlock(
const std::string& table_name , 
const std::vector<Index_t>& record_id);
 
  150     void DeleteInBlock(std::string table_name , 
int block_id , 
const Attribute& attr , 
int index , 
Where where, std::vector<Index_t>& record_ids);
 
  152     void conditionSelectInBlock(std::string table_name , 
const std::vector<Index_t>& record_id , std::vector<MemoryTuple>& v);
 
  153     void SelectInBlock(std::string table_name , 
int block_id , 
const Attribute& attr , 
int index , 
Where where , std::vector<Index_t>& record_ids);