From 459a8a5db66d0eae41edc0d997f35e798cab11fe Mon Sep 17 00:00:00 2001 From: William Bracho Blok Date: Tue, 22 Sep 2015 18:38:04 -0500 Subject: [PATCH] Update Parserv2 --- Parserv2 | 85 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 14 deletions(-) diff --git a/Parserv2 b/Parserv2 index 8e53d6a..675cbb1 100644 --- a/Parserv2 +++ b/Parserv2 @@ -37,21 +37,21 @@ vector tokenize(string ss) } -void par_select(vector input) -{ - // if (input[0] != "(") - // { - // cout<<"ERROR! missing parenthesis"< input) +// { + // // if (input[0] != "(") + // // { + // // cout<<"ERROR! missing parenthesis"< input) { @@ -112,6 +112,49 @@ vector insertCMD(vector input) +vector createCMD(vector input) +{ + //relation name will be the first element of the vector of data returned by this function + // vector output; + + // output.push_back(input[0]) //pushing relation name + + + + // 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() depending on first item from token list { @@ -150,13 +193,27 @@ void par_line(vector 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: "< insertInput = insertCMD(input); + cout<<"arguments: "< listOfTokens = tokenize(ss); par_line(listOfTokens);