📄 glob_var.h
字号:
#ifndef GLOB_VAR_H
#define GLOB_VAR_H
#include "Buffer.h"
#include <iostream>
using namespace std;
extern char CurLocation[256];
extern char CurRelationName[33];
extern char* ErrorMessage[];
enum MSG {CREATE,SELECT,INSERT,UPDATE,DELETE,DROP,QUIT,
SHOWDB,SHOWTABLE,USE,HELP,UNORMAL,NEW,DEFAULT,DROPDB};
//I---int C---char F---float
enum Column_Type {I,C,F};
// > >= < <= = != between…and…;
enum Operator_Type {B, BE, L, LE, E, NE,BETWEEN,ALL};
/////////////////////////////////////////////////////////////////////////////////////////////
//ptr是块指针,Offset精确定位到块中的具体位置
typedef struct TKey_Location* pKey_Location;
typedef struct TKey_Location
{
_F_FileAddr ptr ;
int offset;
bool operator==(TKey_Location key)
{
return (this->ptr == key.ptr && this->offset == key.offset);
}
bool operator!=(TKey_Location key)
{
if(this->ptr == key.ptr && this->offset == key.offset)
return false;
return true;
}
}Key_Location;
/////////////////////////////////////////////////////////////////////////////////////////////
//支持int,char和float类型
union Column_Value
{
int IntValue;
char* pCharValue;
float FloatValue;
};
/////////////////////////////////////////////////////////////////////////////////////////////
//catalog给index的关于选择范围的信息
//使用者:index
typedef struct TKey_Attr* pKey_Attr;
typedef struct TKey_Attr
{
Column_Value value;
pKey_Attr next;
TKey_Attr(){next = NULL;}
}Key_Attr;
typedef struct TCondtion_Info
{
Operator_Type OperType;
pKey_Attr min;
pKey_Attr max;
TCondtion_Info(){
min = NULL;
max = NULL;
OperType = B;
}
}Condition_Info;
/////////////////////////////////////////////////////////////////////////////////////////////
//Catalog得出的关于选择需要的字段信息
//使用者:Record
typedef struct TSelect_Cell
{
char ColumnName[32];
Column_Type ColType;
int PriorLength;
int ColLength;
TSelect_Cell* next;
TSelect_Cell():PriorLength(0),ColLength(0),ColType(I)
{
this->next = NULL;
strcpy(this->ColumnName,"");
}
}Select_Cell;
class Select_Rec_Info
{
public:
Select_Cell* head;
int ColumnNum;
int RecordLength;
Select_Rec_Info():ColumnNum(0) {this->head=NULL;}
~Select_Rec_Info(){};
};
/////////////////////////////////////////////////////////////////////////////////////////////
//Catalog将待插入记录填完整后形成的完整的记录信息
//使用者:Record
typedef struct TCell_Info
{
Column_Type ColType;
Column_Value value;
int PriorLength;
int ColLength;
TCell_Info* next;
TCell_Info(){
next = NULL;
ColType = I;
PriorLength = 0;
ColLength = 0;
}
}Cell_Info;
class Rec_Info
{
public:
Cell_Info* head;
int ColNum;
int RecordLength;
Rec_Info(){
head = NULL;
ColNum = 0;
}
~Rec_Info(){};
};
#endif //GLOB_BAR_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -