int main(int argc, const char* argv[])
{
	cout << "DBMS started.\n";

	Database database = Database();

	vector<string> columnNames;
	columnNames.push_back("Names");
	columnNames.push_back("Ages");
	Table first = Table("DiffTest1", columnNames, 2);
	//Table second = Table("DiffTest2", 2);
	vector<string> firstEntVec;
	firstEntVec.push_back("Bob");
	firstEntVec.push_back("1");
	
	first.addEntry(Entry(firstEntVec));
	first.printTable();

	//to be added later -WB
	//database.addTable(first);
	//database.addTable(second);


	//difference (will uncomment once Table has fixed compile errors)
	//Table diff = database.differences(first, second);

	cout << "\n\n";
	system("PAUSE");
}
Ejemplo n.º 2
0
//helper function
	Table initialize(){
		vector < string > in;
		string input = " ";
		int i = 0;
		Table t;
		ifstream fin("database.txt",ios::in); 
		while(fin.good()){

			getline(fin, input, '|'); 

			if(input == "[()]" && i == 0){
				Table q(in);
				for(int q = 0; q<in.size(); q++)
					cout << in[q] <<endl;

				in.clear();
				t = q;
				i++;
			}
			else if(input == "[()]"){ // [()] is the end of line delimeter
				t.addEntry(in);
				for(int q = 0; q<in.size(); q++)
					cout << in[q] <<endl;
				in.clear();
			}
			else
				in.push_back(input);
		}

		fin.close();
		return t;
	}
Ejemplo n.º 3
0
int main(int argc, char *argv[])
{
	GetOption get_option(argc, argv);
	string config_file = "";
	get_option.getOption("config", config_file);

	YamlConfig *app_config = new YamlConfig(config_file);
	database_config = new ConnectionDetails(*app_config);
	conn_config = database_config;
	yamlConfig = app_config;
	s_pwd = helper.getPWD(argv[0], "./");
	initialize_logger(*app_config);

#ifdef WATCHLIST_MYSQL
	cout << "compiled for mysql " << endl;
#endif

	initConnectionPool();

	Table *WatchObj = new Table("watchlists");
	
	Record new_record;
	new_record.addColumn("account_id", "001", field::TYPE_STRING, 64);
	new_record.addColumn("name", "WATCH001", field::TYPE_STRING, 64);

	WatchObj->print_status();
	cout << "size: " << new_record.getLength() << endl;
	WatchObj->addEntry(new_record);


	vector<field> fields;
	vector<condition> conditions;

	ADD_TO_FIELDS("name", field::TYPE_STRING, 64, fields) // setting the fields for variable binding
	ADD_TO_FIELDS("id", field::TYPE_STRING, 64, fields)
	ADD_TO_FIELDS("account_id", field::TYPE_STRING, 64, fields)

	ADD_TO_CONDITIONS("account_id",field::TYPE_STRING,"001",conditions)
	ADD_TO_CONDITIONS("name",field::TYPE_STRING,"test_watch1234",conditions)

	WatchObj->print_status();
	WatchObj->select(fields,conditions);
	WatchObj->print_status();

	delete WatchObj;
	delete logger;
	delete app_config;
	delete database_config;
	return 0;
}