From ac43cf74b94ab4eb4eff3e14d648c383156fed3b Mon Sep 17 00:00:00 2001 From: William Bracho Blok Date: Tue, 22 Sep 2015 17:11:51 -0500 Subject: [PATCH] Update Parserv2 --- Parserv2 | 55 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/Parserv2 b/Parserv2 index af89934..8e53d6a 100644 --- a/Parserv2 +++ b/Parserv2 @@ -63,22 +63,51 @@ void displayTokenList(vector input) } -void insertCMD(vector input) +vector insertCMD(vector input) { - string relationName; - - cout<<"insert-cmd function was called"< output; + if (input[0] == "INTO") { input.erase(input.begin()); - relationName = input[0]; + + output.push_back(input[0]); //pushing relation name + + input.erase(input.begin()); + + if (input[0] == "VALUES" && input[1] == "FROM") + { + input.erase(input.begin()); + input.erase(input.begin()); + + + if(input[0] == "(") + { + input.erase(input.begin()); + + while(input[0] != ")") //inserting all values to relation + //for (int i = 0; i < 2; ++i) + { + if (input[0] == ",") input.erase(input.begin()); + + output.push_back(input[0]); + + input.erase(input.begin()); + } + + return output; + + } + + else cout<<"Syntax error!"< input) //calls par_command() or par_query() dependi if ( input[0] == "INSERT") { + cout<<"\nPassing the following arguments to dbEngine: \nCommand type: "< insertInput = insertCMD(input); + cout<<"arguments: "<