Just to keep most recent changes on server.
This commit is contained in:
parent
260d6bfd4c
commit
5e58734054
3 changed files with 28 additions and 9 deletions
|
@ -113,7 +113,7 @@ Relation& DBEngine::getTableFromName(string n){
|
||||||
}
|
}
|
||||||
|
|
||||||
Relation DBEngine::selection(string attName, string s, Relation r){
|
Relation DBEngine::selection(string attName, string s, Relation r){
|
||||||
equality(attName, s, r);
|
return equality(attName, s, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
//assumes that all attribute titles are unique
|
//assumes that all attribute titles are unique
|
||||||
|
|
35
Parser.cpp
35
Parser.cpp
|
@ -507,6 +507,13 @@ vector<string> deleteCMD(vector<string> input, DBEngine &engine)
|
||||||
else cout<<"Syntax error!"<<endl;
|
else cout<<"Syntax error!"<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void query(vector<string> input, DBEngine &engine)
|
||||||
|
{
|
||||||
|
PRelation pr(input[0]);
|
||||||
|
|
||||||
|
input.erase(input.begin());
|
||||||
|
}
|
||||||
|
|
||||||
void par_line(vector<string> input, DBEngine &engine) //calls par_command() or par_query() depending on first item from token list
|
void par_line(vector<string> input, DBEngine &engine) //calls par_command() or par_query() depending on first item from token list
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -533,7 +540,7 @@ void par_line(vector<string> input, DBEngine &engine) //calls par_command() or p
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( input[0] == "CREATE")
|
else if ( input[0] == "CREATE")
|
||||||
{
|
{
|
||||||
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
||||||
input.erase(input.begin());
|
input.erase(input.begin());
|
||||||
|
@ -544,7 +551,7 @@ void par_line(vector<string> input, DBEngine &engine) //calls par_command() or p
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( input[0] == "DELETE")
|
else if ( input[0] == "DELETE")
|
||||||
{
|
{
|
||||||
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
||||||
input.erase(input.begin());
|
input.erase(input.begin());
|
||||||
|
@ -555,7 +562,7 @@ void par_line(vector<string> input, DBEngine &engine) //calls par_command() or p
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( input[0] == "UPDATE")
|
else if ( input[0] == "UPDATE")
|
||||||
{
|
{
|
||||||
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
||||||
input.erase(input.begin());
|
input.erase(input.begin());
|
||||||
|
@ -566,40 +573,52 @@ void par_line(vector<string> input, DBEngine &engine) //calls par_command() or p
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( input[0] == "SHOW")
|
else if ( input[0] == "SHOW")
|
||||||
{
|
{
|
||||||
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
||||||
input.erase(input.begin());
|
input.erase(input.begin());
|
||||||
showCMD(input, engine);
|
showCMD(input, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( input[0] == "EXIT")
|
else if ( input[0] == "EXIT")
|
||||||
{
|
{
|
||||||
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
||||||
input.erase(input.begin());
|
input.erase(input.begin());
|
||||||
exitCMD(input, engine);
|
exitCMD(input, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( input[0] == "OPEN")
|
else if ( input[0] == "OPEN")
|
||||||
{
|
{
|
||||||
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
||||||
input.erase(input.begin());
|
input.erase(input.begin());
|
||||||
openCMD(input, engine);
|
openCMD(input, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( input[0] == "SAVE")
|
else if ( input[0] == "SAVE")
|
||||||
{
|
{
|
||||||
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
||||||
input.erase(input.begin());
|
input.erase(input.begin());
|
||||||
saveCMD(input, engine);
|
saveCMD(input, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( input[0] == "CLOSE")
|
else if ( input[0] == "CLOSE")
|
||||||
{
|
{
|
||||||
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
||||||
input.erase(input.begin());
|
input.erase(input.begin());
|
||||||
closeCMD(input, engine);
|
closeCMD(input, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if( input[1] == "<-")
|
||||||
|
{
|
||||||
|
cout<<"Passing query to dbEngine."<<endl;
|
||||||
|
query(input, engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cout<<"Not a valid command or query."<<endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
test
BIN
test
Binary file not shown.
Reference in a new issue