diff --git a/Parserv3.h b/Parserv3.h index 0064a9b..ff44cfd 100644 --- a/Parserv3.h +++ b/Parserv3.h @@ -37,6 +37,7 @@ class PAttribute string name; string type; string size; + bool key; public: PAttribute() @@ -44,6 +45,7 @@ class PAttribute name = "~"; type = "~"; size = "~"; + key = false; } PAttribute(string str, string t) @@ -51,6 +53,7 @@ class PAttribute name = str; type = t; size = "~"; + key = false; } PAttribute(string str, string t, string s) @@ -58,6 +61,7 @@ class PAttribute name = str; type = t; size = s; + key = false; } void setPAttributeName(string str) @@ -75,6 +79,11 @@ class PAttribute size = s; } + void setPAttributeKey() + { + key = true; + } + string getPAttribute() { return name; diff --git a/Parserv4.cpp b/Parserv4.cpp index f6c0bb4..09a7383 100644 --- a/Parserv4.cpp +++ b/Parserv4.cpp @@ -127,8 +127,6 @@ vector createCMD(vector input) { input.erase(input.begin()); - //vector e1; - vector a; while(input[0] != ")") //inserting all values to relation @@ -159,8 +157,6 @@ vector createCMD(vector input) a.push_back(temp); } - vector apk; //save primary keys temp storage - if(input[0] == "PRIMARY" && input[1] == "KEY") { input.erase(input.begin()); @@ -171,21 +167,23 @@ vector createCMD(vector input) while(input[0] != ")") //inserting all values to relation { - PAttribute temp; if (input[0] == ",") { input.erase(input.begin()); } - temp.setPAttributeName(input[0]); - - apk.push_back(temp); + for(int i = 0; i < a.size(); ++i) + { + if(input[0] == a[i].getPAttribute()) + { + a[i].setPAttributeKey(); + break; + } + } input.erase(input.begin()); } - - return input; } diff --git a/a.out b/a.out index d954f1a..4375acc 100755 Binary files a/a.out and b/a.out differ