diff --git a/Parser.cpp b/Parser.cpp index ab5965a..e7c8da1 100644 --- a/Parser.cpp +++ b/Parser.cpp @@ -71,6 +71,7 @@ tuple, Relation> expression(vector input, DBEngine &engin input.erase(input.begin()); get<0>(t) = input; get<1>(t) = rfinal; + //cout << rfinal.getSize() << endl; return t; } else if(input[0] == "(") @@ -79,6 +80,7 @@ tuple, Relation> expression(vector input, DBEngine &engin rfinal = engine.projection(temp, get<1>(t)); //get<0>(t) = input; get<1>(t) = rfinal; + //cout << rfinal.getSize() << endl; return t; } } @@ -611,8 +613,16 @@ vector insertCMD(vector input, DBEngine &engine) input.erase(input.begin()); tuple, Relation> t = expression(input, engine); - - engine.createTable(get<1>(t)); + vector a = get<1>(t).getAttributes(); + for(int y = 0; y < a[0].getSize(); ++y) + { + for(int x = 0; x < a.size(); ++x) + { + s.push_back(a[x].getValues()[y]); + engine.insertValues(r.getTableName(), s); + s.clear(); + } + } input = get<0>(t); diff --git a/Relation.cpp b/Relation.cpp index b53ac36..3f9fb7b 100755 --- a/Relation.cpp +++ b/Relation.cpp @@ -82,6 +82,8 @@ void Relation::display(){ } void Relation::insertTuple(vector tuple){ + cout << name << " " << size << endl; + cout << tuple.size() << endl; if (tuple.size() != this->size) { cout << "Failure to insert: the sizes do not match."; } diff --git a/test b/test index fc260be..b0e69f8 100755 Binary files a/test and b/test differ