diff --git a/db_engine.cpp b/db_engine.cpp index fc004f9..10abbbf 100755 --- a/db_engine.cpp +++ b/db_engine.cpp @@ -1,12 +1,13 @@ #include "db_engine.h" db_engine::db_engine(){ - //USELESS COMMENT + // } //create a new table in memory -db_engine::createCmd(){ - //// +//creates a vector +void db_engine::createCmd(){ + // } //open a txt file, parse SQL script, load data in table @@ -14,9 +15,18 @@ db_engine::createCmd(){ // //} -//save all the commands to the db text file +//should write cmdList to a .txt file void db_engine::saveCmd(){ - // + std::ofstream dbCmdFile; + dbCmdFile.open("dbCmds.txt", std::ios_base::app); + + std::vector::iterator it = cmdList.begin(); + while (it != cmdList.end()){ + dbCmdFile << *it << "\n"; + ++it; + } + + cmdList.clear(); } //display the table currently stored in memory diff --git a/db_engine.h b/db_engine.h index 3543acf..ba2ea28 100755 --- a/db_engine.h +++ b/db_engine.h @@ -1,5 +1,9 @@ -class db_engine { - //useless comment +#include +#include +#include + +class db_engine { + std::vector cmdList; public: db_engine(); diff --git a/test.cpp b/test.cpp index cc7dc7c..37541d8 100755 --- a/test.cpp +++ b/test.cpp @@ -1,5 +1,8 @@ #include +#include "db_engine.h" -int main() { - std::cout << "Hello nothing!"; +int main() { + db_engine engine; + engine.saveCmd(); + std::cout << "succesfully traversed the code!"; } \ No newline at end of file