diff --git a/DBEngine.cpp b/DBEngine.cpp index fa8575c..4e8ffb9 100755 --- a/DBEngine.cpp +++ b/DBEngine.cpp @@ -212,31 +212,24 @@ Relation DBEngine::crossProduct(Relation r1, Relation r2){ new_atts[i].clearAllValues(); } + //currently all returned relations are called TEMP + Relation new_r("TEMP", new_atts); + vector r1_tuple; vector r2_tuple; + vector temp; for (int i = 0; i < r1_attsize; ++i) { r1_tuple = r1.getTuple(i); - for (int a = 0; a < r1_tuple.size(); ++a) { - cout << r1_tuple[a] << " "; - } - for (int j = 0; j < r2_attsize; ++j) { r2_tuple = r2.getTuple(j); + temp = r1_tuple; + temp.insert(temp.end(), r2_tuple.begin(), r2_tuple.end()); - for (int b = 0; b < r2_tuple.size(); ++b){ - cout << r2_tuple[b] << " "; - } - - cout << "\n"; + new_r.insertTuple(temp); } - - cout << "\n\n"; } - - //currently all returned relations are called TEMP - Relation new_r("TEMP", new_atts); return new_r; diff --git a/a.out b/a.out new file mode 100755 index 0000000..a30738a Binary files /dev/null and b/a.out differ