-
Notifications
You must be signed in to change notification settings - Fork 1
/
indexmanager.h
executable file
·49 lines (41 loc) · 1.3 KB
/
indexmanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#ifndef INDEXMANAGER_H
#define INDEXMANAGER_H
#include "BPlusTree/bplustree.h"
#include "BufferManager.h"
#include <map>
#include <string>
#include <iostream>
#include "MiniSQL.h"
/*
struct keyOffsetNode{
int key;
DataType data;
};
*/
bool check(char* p);
typedef keyOffsetNode KeyOffset;
extern BufferManager block_record;
class IndexManager{
public:
IndexManager();
~IndexManager();
//创建索引
void createIndex(string db, string table, string attr, vector<KeyOffset> records, int tag);
//内存上删除索引
void dropIndex(string db, string table, string attr);
//内存上插入记录,同时修改索引文件
void insertRecord(string db, string table, string attr,KeyType key, DataType data);
//内存上插入记录,同时修改索引文件
void deleteRecord(string db, string table, string attr,KeyType key);
//查找,返回地址列表
vector<DataType> selectRecord(string db, string table, string attr,int key, string opcode);
vector<DataType> selectBetweenRecord(string db, string table, string attr,KeyType low, KeyType high);
//是否存在
bool search(string db, string table, string attr,KeyType key);
//打印索引列表
void print();
private:
map<string, BPlusTree*> indexMap;
};
#endif // INDEXMANAGER_H