done saveCmd

This commit is contained in:
Becca 2015-09-14 16:46:49 -05:00
parent b98c396637
commit 0b3fa73bda
4 changed files with 26 additions and 5 deletions

5
dbCmds.txt Normal file
View file

@ -0,0 +1,5 @@
a
b
c
d
e

View file

@ -1,13 +1,16 @@
#include "db_engine.h"
db_engine::db_engine(){
//
cmdList.push_back("a");
cmdList.push_back("b");
cmdList.push_back("c");
cmdList.push_back("d");
}
//create a new table in memory
//creates a vector
void db_engine::createCmd(){
////
//
}
//open a txt file, parse SQL script, load data in table
@ -15,9 +18,18 @@ void 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<std::string>::iterator it = cmdList.begin();
while (it != cmdList.end()){
dbCmdFile << *it << "\n";
++it;
}
cmdList.clear();
}
//display the table currently stored in memory

View file

@ -1,3 +1,4 @@
#include <fstream>
#include <iostream>
#include <vector>

View file

@ -1,5 +1,8 @@
#include <iostream>
#include "db_engine.h"
int main() {
std::cout << "Hello World!";
db_engine engine;
engine.saveCmd();
std::cout << "succesfully traversed the code!";
}