Fixing things
This commit is contained in:
commit
2ef0ca32fc
4 changed files with 53 additions and 18 deletions
31
Parser.cpp
31
Parser.cpp
|
@ -581,7 +581,7 @@ tuple<vector<string>, Relation> expression(vector<string> input, DBEngine &engin
|
||||||
vector<string> showCMD(vector<string> input, DBEngine &engine)
|
vector<string> showCMD(vector<string> input, DBEngine &engine)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(engine.isRelation(input[0]))
|
if(engine.isRelation(input[0]) && (input[1] != "+" && input[1] != "-" && input[1] != "*"))
|
||||||
{
|
{
|
||||||
engine.getTableFromName(input[0]).display();
|
engine.getTableFromName(input[0]).display();
|
||||||
input.erase(input.begin());
|
input.erase(input.begin());
|
||||||
|
@ -954,6 +954,7 @@ vector<string> updateCMD(vector<string> input, DBEngine &engine)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// send update command to DBEngine
|
// send update command to DBEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -967,36 +968,30 @@ vector<string> deleteCMD(vector<string> input, DBEngine &engine)
|
||||||
input.erase(input.begin());
|
input.erase(input.begin());
|
||||||
input.erase(input.begin());
|
input.erase(input.begin());
|
||||||
|
|
||||||
PRelation r(input[0]);
|
Relation rcond = engine.getTableFromName(input[0]);
|
||||||
|
Relation rfinal = engine.getTableFromName(input[0]);
|
||||||
|
|
||||||
|
input.erase(input.begin());
|
||||||
|
|
||||||
|
vector<string> s;
|
||||||
|
|
||||||
if(input[0] == "WHERE")
|
if(input[0] == "WHERE")
|
||||||
{
|
{
|
||||||
|
input.erase(input.begin());
|
||||||
if(input[0] == "(")
|
if(input[0] == "(")
|
||||||
{
|
{
|
||||||
//PCondition c;
|
input.erase(input.begin());
|
||||||
|
|
||||||
PComparison c;
|
|
||||||
POperand oops1;
|
|
||||||
POperand oops2;
|
|
||||||
POp op;
|
|
||||||
|
|
||||||
while(input[0] != ")")
|
while(input[0] != ")")
|
||||||
{
|
{
|
||||||
oops1.setPOperand(input[0]);
|
s.push_back(input[0]);
|
||||||
input.erase(input.begin());
|
input.erase(input.begin());
|
||||||
|
|
||||||
oops2.setPOperand(input[0]);
|
|
||||||
input.erase(input.begin());
|
|
||||||
|
|
||||||
op.setPOp(input[0]);
|
|
||||||
input.erase(input.begin());
|
|
||||||
|
|
||||||
c.setPComparison(oops1.getPOperand(), op.getPOp(), oops2.getPOperand());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rcond = condition();
|
||||||
// send delete command to DBEngine
|
// send delete command to DBEngine
|
||||||
|
|
||||||
}
|
}
|
||||||
else cout<<"Syntax error!"<<endl;
|
else cout<<"Syntax error!"<<endl;
|
||||||
}
|
}
|
||||||
|
|
37
User.cpp
Normal file
37
User.cpp
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
#include "user.h"
|
||||||
|
|
||||||
|
User::User(){
|
||||||
|
name = "";
|
||||||
|
password = "";
|
||||||
|
phone_number = "";
|
||||||
|
fax_number = "";
|
||||||
|
postal_address = "";
|
||||||
|
is_admin = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
User::User(string n, string pass, string phone, string fax, string postal, bool admin){
|
||||||
|
name = n;
|
||||||
|
password = pass;
|
||||||
|
phone_number = phone;
|
||||||
|
fax_number = fax;
|
||||||
|
postal_address = postal;
|
||||||
|
is_admin = admin;
|
||||||
|
}
|
||||||
|
|
||||||
|
string User::getName() {return name;}
|
||||||
|
string User::getPassword() {return password;}
|
||||||
|
string User::getPhoneNumber() {return phone_number;}
|
||||||
|
string User::getFaxNumber() {return fax_number;}
|
||||||
|
string User::getPostalAddress() {return postal_address;}
|
||||||
|
bool User::confirmAdmin() {return is_admin;}
|
||||||
|
bool User::checkLogin() {return is_logged_in;}
|
||||||
|
vector<string> User::getGroups(){return groups;}
|
||||||
|
vector<string> User::getMessages(){return messages;}
|
||||||
|
|
||||||
|
void User::setName(string new_name) {name = new_name;}
|
||||||
|
void User::setPassword(string new_password) {password = new_password;}
|
||||||
|
void User::setPhone(string new_phone) {phone_number = new_phone;}
|
||||||
|
void User::setFax(string new_fax) {fax_number = new_fax;}
|
||||||
|
void User::setPostal(string new_postal) {postal_address = new_postal;}
|
3
User.h
3
User.h
|
@ -41,4 +41,7 @@ public:
|
||||||
Message();
|
Message();
|
||||||
Message(string time, string t);
|
Message(string time, string t);
|
||||||
};
|
};
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> a478d7914de8de7750d1c877475def9cfb3ac83b
|
||||||
|
|
BIN
test
BIN
test
Binary file not shown.
Reference in a new issue