⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 record.h

📁 用c语言实现的一个小型dbms
💻 H
字号:


#ifndef _RECORD_H_
#define _RECORD_H_

//-------------------------------------------------------------

#include "buffer.h"
#include "Glob_Var.h"

//-------------------------------------------------------------

/*********************************************************
*            文件中被删除记录维护结构体,用以删除、插入操作
*            使插入的时候可以插入在原来被删除的记录的文件空间        
**********************************************************/
typedef struct{
    _F_FileAddr DelFirst;  // 第一个被删除的记录的地址
    _F_FileAddr DelLast;   // 最后一个被删除的记录的地址
    _F_FileAddr NewInsert;  // 文件末尾第一个可插入记录的地址
}_F_DELLIST;

//-------------------------------------------------------------
/***************************************************************
*遍历所要的和所要定义的结构体
****************************************************************/ 

typedef struct TSelect_Cond_Cell
{
	char			ColumnName[32];	//字段名――方便打印
	Column_Type		ColType;		//字段类型――方便打印
	int				PriorLength;		//记录头到此字段之间的长度
	int				ColLength;			//字段类型的长度
	Column_Value    ColSelValue;           //记录值
	Operator_Type   OperType;         //条件类
	TSelect_Cond_Cell*	next;				//下一个字段信息
	TSelect_Cond_Cell():PriorLength(0),ColLength(0),ColType(I),OperType(B) 
	{	
		this->next = NULL;
		strcpy(this->ColumnName,"");	
	}
}Select_Cond_Cell;

class Select_Cond_Info
{
public:
	Select_Cond_Cell*	head;
	int				ColumnNum;
	int             RecordLength;
	Select_Cond_Info():ColumnNum(0) {this->head=NULL;}
	~Select_Cond_Info(){};
};


/*********************************************************
*            Record类,包含了Record模块所有操作
**********************************************************/
class Record
{
private:
  _F_DELLIST* m_DelList;
  _M_File* m_DbfFile;
public:
    Record();
    ~Record(){}
    _F_FileAddr Insert(Rec_Info&);      //插入一个Tuple
    void Delete(_F_FileAddr&);          //删除一个Tuple
    void Update(_F_FileAddr&,Rec_Info&);//更新数据
    Rec_Info* Select(_F_FileAddr&,Select_Rec_Info&) const;//选择单条Tuple
    void PrintHead(Select_Rec_Info&) const;       //打印列表头
    void Print(_F_FileAddr&,Select_Rec_Info&) const;//打印record with index
	void PrintEnd(Select_Rec_Info& SelRecInfo) const;
	int Print(Select_Rec_Info& prilist, Select_Cond_Info &SelCondInfo);//打印 record without index
};

//-----------------------------------------------------------------

#endif //_RECORD_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -