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

📄 struct.h

📁 一个c语言开发的小型的dbms系统
💻 H
字号:
/*-----这里定义了各个语句的语法树的结构-----*/

/*-------------CONDITIONS-----------------------*/
typedef struct	_conditions{
	struct _conditions		*left;
	struct _conditions		*right;
	char			comp_op;	/*('a'--and),('o'--or), '<' , '>' , '='  */
	char			type;	/*'2'--是表的字段,'1'--是字符串型,'0'--是整型*/
	char			*table;	/*不为NULL就存放表名*/
	char			*value;	/*存放字段名,字符串或整数的值,要看type的值*/	
	int			intval;	/*用于以后计算的时候存储结果*/
	}_conditions_type;

/*-------------SELECT-----------------------*/
typedef	struct	_selectedfields{	/*select语句中选中的字段*/
	char 			*table;
	char 			*field;
	struct 	_selectedfields	*next_sf;
	}_selectedfields_type;
typedef struct	_selectedtables{	/*select语句中选中的表*/
	char			*table;
	struct	_selectedtables	*next_st;
	}_selectedtables_type;
typedef struct	_selectstruct{		/*select语法树的根节点*/
	_selectedfields_type 	*sf;
	_selectedtables_type	*st;
	_conditions_type		*cons;
	}_selectstruct_type;

/*----------------DROP----------------------*/
typedef struct _dropstruct{
	char *table;
	}_dropstruct_type;

/*-------------CREATE-----------------------*/
typedef struct	_createfieldsdef{		/*create语句中的字段定义*/
	char	*field;
	char	*type;
	char	*length;
	struct	_createfieldsdef	*next_fdef;
	}_createfieldsdef_type;
typedef struct	_createstruct{		/*create语法树根节点*/
	char	*table;
	_createfieldsdef_type	*fdef;
	}_createstruct_type;
/*-------------INSERT-----------------------*/
typedef struct	_insertfields{
	char	*field;
	struct	_insertfields	*next_if;
	}_insertfields_type;
typedef struct	_insertvalues{		/*insert语句中的字段值*/
	char	*value;
	char	type;			/*'0'表示整型,'1'表示字符串*/
	struct	_insertvalues	*next_iv;
	}_insertvalues_type;
typedef struct	_insertstruct{		/*insert语法树根节点*/
	char	*table;
	_insertfields_type		*ifs;
	_insertvalues_type		*iv;
	}_insertstruct_type;
/*-------------DELETE-----------------------*/
typedef	struct	_deletestruct{
	char	*table;
	_conditions_type		*cons;
	}_deletestruct_type;

/*--------------------数据字典的结构-----------------------*/
typedef	struct tab_dic_type{		/*表字典表*/
	char tab_name[10];
 	int  tab_id;
	int  first_free_block;
	int  col_num;
	int  row_num;
	int  row_len;
	}_tab_dic_type;

typedef	struct col_dic_type{		/*列字典表*/
	int  tab_id;
 	char col_name[30];
	int  col_id;
	int  col_type;
	int  col_length;
	}_col_dic_type;

typedef	struct dic_type{
	_tab_dic_type 	tab[30];		/*表数据字典数据*/
	int		tab_num;		/*表个数*/
	_col_dic_type 	col[300];		/*字段数据字典数据*/
	int		col_num;		/*字段个数*/
	}_dic_type;

struct data_head
{int next_block;
 int next_free_addr;
 int last_block;
};
struct _fieldval
{
	int		type;
	int		length;
	int		intval;
	char	*charval;
	int		col_id;
	struct  _fieldval	*next;	
};
struct	_fval
{
	int		type;
	int		iVal;
	char	szVal[255];
};

⌨️ 快捷键说明

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