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

📄 f_command.cpp

📁 小型数据库源代码较多
💻 CPP
字号:
#include "min.h"


void sql::f_command(ifstream& in)
{
 
	in>>command;
    while (strcmp(command,"")) //退出MiniSQL系统
	{

		try{
			if(!strcmp(command,"create")) 
			{
				in>>command;
				if(!strcmp(command,"table"))
				{
					//创建表语句
					create_table(in);
				}
				else if(!strcmp(command,"index"))
				{					
					//创建索引语句
					create_index(in);
				}
				else throw 1;
			}
		
			else if(!strcmp(command,"drop")) 
			{	
				in>>command;
				if(!strcmp(command,"table"))
				{
					drop_table(in);
                  //删除表语句
				}
				else if(!strcmp(command,"index"))
				{
				  drop_index(in);
					//删除索引语句
				}
				else throw 1;
			}
		
			else if(!strcmp(command,"select")) 
			{
			   select_from(in);
				//选择语句
			}
				

			else if(!strcmp(command,"insert")) 
			{
		
		
				insert_into(in);
				//插入记录语句
			    
			}

			else if(!strcmp(command,"delete")) 
			{
			    
				delete_from(in);
				//删除记录语句
			}
			
			else if( !strcmp(command,"quit;") )
			{
	             
				 FlushBuffer(); // 释放缓存区
		         Update_Dictionary(); //更新数据字典
				
				
				 cout<<"*************************************************************************\n";

				 cout<<"**                      Thanks You For Using LittleMouse!              **\n";
				 cout<<"**            Copyright Chenhai, HeYijun , JiangNan, XuYongjian        **\n";

				 cout<<"*************************************************************************\n";

				 cout<<"请按任意键退出!\n";
				 Log("退出系统!");
				 sql::Log("脚本文件 "+filename+"执行完毕!");
				 getchar();
				 getchar();
				 exit(1);
				
			}

			else throw 1;
		}

		catch(int)
		{
			while(!strstr(command,";"))
				in>>command;
			cout<<"语法错误!"<<endl;
		    
			Log("语法错误!");
		
		}
		/////////////////////////////////////////////////////////////////
		//                   清空命令行                                //
		/////////////////////////////////////////////////////////////////
		erasecom();

		/////////////////////////////////////////////////////////////////
		//                重新等待输入命令行                           //  
		/////////////////////////////////////////////////////////////////
	
	    in>>command;
	}


}

⌨️ 快捷键说明

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