资源简介
1、源程序:DBMS;
2、数据文件:data;
3、测试所使用的SQL语句:sql.log;
4、DBMS程序皮肤文件:audk.exe,先安装后采用 Microsoft Visual Studio C++ 6.0 运行程序;
5、数据信息文件存储在E:\\data目录下,具体设置见源程序(DBMS)下init.ini文件;
5、数据库系统原理文档记录:设计报告;
6、用户名、密码均在源程序 (DBMS) 下的user.ini文件中,超级管理员用户名:root,密码:root。
注:
1、“查询优化”按钮只在使用优化技术时才使用。由于时间关系,没有处理故会出现错误!
其他所有情况均使用“执行SQL”按钮。具体使用“查询优化”按钮时可见sql.log文件中优化部分。
2、 程序中存在很多Bug,望读者自行调试相关Bug并运行程序。
代码片段和文件信息
// Compiler.cpp: implementation of the CCompiler class.
//
//////////////////////////////////////////////////////////////////////
#include “stdafx.h“
#include “DBMS.h“
#include “Compiler.h“
#include “DDL.h“
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CCompiler::CCompiler()
{
}
CCompiler::~CCompiler()
{
}
BOOL CCompiler::SQL_Compile(CString sql char error[50])
{
int next_start = 0;
char tokens[25] token[2];
next_start = Get_Tokens(sql tokens token 0) + 1;
if(strcmp(tokens “create“) == 0){ //处理 “create”
next_start = Get_Tokens(sql tokens token next_start) + 1;
if(strcmp(tokens “database“) == 0){ //处理 “database”
next_start = Get_Tokens(sql tokens token next_start) + 1;
if(strcmp(tokens ““) != 0 && strcmp(token “;“) == 0){
return TRUE;
}else{ //报告错误!!!
strcpy(error “无“;”!“);
return FALSE;
}
}else if(strcmp(tokens “table“) == 0){ //处理 “table”
//create table apple(a_id int a_name char(15) a_pri float a_addr char(25));
//create table apple(a_id int a_name char a_pri float a_addr char);
next_start = Get_Tokens(sql tokens token next_start) + 1;
if(strcmp(tokens ““) != 0 && strcmp(token “(“) == 0){ //开始处理 ()
flag_table:while(1){
next_start = Get_Tokens(sql tokens token next_start) + 1;
if(strcmp(tokens ““) != 0){
next_start = Get_Tokens(sql tokens token next_start) + 1;
if((strcmp(tokens “int“) == 0 || strcmp(tokens “float“) == 0 ) && strcmp(token ““) == 0){
goto flag_table;
}else if(strcmp(tokens “char“) == 0 && strcmp(token “(“) == 0){
next_start = Get_Tokens(sql tokens token next_start) + 1;
if(strcmp(tokens ““) != 0 && strcmp(token “)“) == 0){
next_start = Get_Tokens(sql tokens token next_start) + 1;
if(strcmp(token ““) == 0){
goto flag_table;
}else if(strcmp(token “)“) == 0){
//return FALSE;
break;
}else{
strcpy(error “括号内写错!“);
return FALSE;
}
}else{
return FALSE;
}
}else if((strcmp(tokens “int“) == 0 || strcmp(tokens “float“) == 0 ) && strcmp(token “)“) == 0){
break;
}else{
return FALSE;
}
}else{
return FALSE;
}
}
next_start = Get_Tokens(sql tokens token next_start) + 1;
if(strcmp(token “;“) == 0){
return TRUE;
}else{
return FALSE;
}
}else{
return FALSE;
}
}else if(strcmp(tokens “index“) == 0){ //处理 “index”
next_start = Get_Tokens(sql tokens token next_start) + 1;
if(strlen(tokens) != 0){
next_st
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 213 2009-07-24 14:19 数据库管理系统(DBMS)\data\C.ini
文件 381 2009-07-24 13:59 数据库管理系统(DBMS)\data\Course.ini
文件 1671269 2009-07-24 14:02 数据库管理系统(DBMS)\data\Course_index.ini
文件 5938271 2009-07-24 13:58 数据库管理系统(DBMS)\data\Course_info.ini
文件 41 2009-07-24 14:19 数据库管理系统(DBMS)\data\C_info.ini
文件 97 2009-07-24 14:35 数据库管理系统(DBMS)\data\Databa
文件 143 2009-07-24 14:08 数据库管理系统(DBMS)\data\R.ini
文件 102 2009-07-24 14:06 数据库管理系统(DBMS)\data\result_and.ini
文件 53 2009-07-24 14:06 数据库管理系统(DBMS)\data\result_minus.ini
文件 232 2009-07-24 14:06 数据库管理系统(DBMS)\data\result_or.ini
文件 48 2009-07-24 14:08 数据库管理系统(DBMS)\data\R_info.ini
文件 142 2009-07-24 14:09 数据库管理系统(DBMS)\data\S.ini
文件 144 2009-07-24 14:19 数据库管理系统(DBMS)\data\SC.ini
文件 191 2009-07-24 14:19 数据库管理系统(DBMS)\data\SC_info.ini
文件 8948 2009-07-24 14:34 数据库管理系统(DBMS)\data\sql.log
文件 198 2009-07-24 14:06 数据库管理系统(DBMS)\data\Stu1.ini
文件 65 2009-07-24 14:06 数据库管理系统(DBMS)\data\Stu1_index.ini
文件 179 2009-07-24 14:06 数据库管理系统(DBMS)\data\Stu1_info.ini
文件 197 2009-07-24 14:05 数据库管理系统(DBMS)\data\Stu2.ini
文件 55 2009-07-24 14:06 数据库管理系统(DBMS)\data\Stu2_index.ini
文件 154 2009-07-24 14:05 数据库管理系统(DBMS)\data\Stu2_info.ini
文件 203 2009-07-24 14:21 数据库管理系统(DBMS)\data\Student.ini
文件 229 2009-07-24 14:21 数据库管理系统(DBMS)\data\Student_info.ini
文件 36 2009-07-24 14:09 数据库管理系统(DBMS)\data\S_info.ini
文件 288 2009-07-24 14:14 数据库管理系统(DBMS)\data\topic.ini
文件 330 2009-07-24 14:14 数据库管理系统(DBMS)\data\topic_info.ini
文件 181 2009-07-24 14:13 数据库管理系统(DBMS)\data\user.ini
文件 79 2009-07-24 14:13 数据库管理系统(DBMS)\data\user_info.ini
文件 18410 2008-08-15 17:31 数据库管理系统(DBMS)\DBMS\AppFace.h
文件 16964 2009-07-17 18:23 数据库管理系统(DBMS)\DBMS\Compiler.cpp
............此处省略115个文件信息
- 上一篇:序贯相似算法图像匹配
- 下一篇:C++ Primer第五版 源代码
评论
共有 条评论