Exemple #1
0
int main() {

	
	// Create records to add to tables
	vector<String> test;
	vector<String> test2;

	test.push_back("Apple");
	test.push_back("Tuesday");
	test.push_back("No");
	test.push_back("85");

	test2.push_back("Oranges");
	test2.push_back("Wednesday");
	test2.push_back("Yes"); 
	test2.push_back("6");

	Record a (test);
	Record b (test2);


	// Create a table to add records too, and then add to the database
	Table testTable;

	testTable.add_column("Stock","String");
	testTable.add_column("Time","Date");
	testTable.add_column("Sucks","String");
	testTable.add_column("Price","Integer");
	testTable.insert_row(a);
	testTable.insert_row(b);
	String output=testTable.Get_Column_Attributes();


	// Create a test database

	Database testDatabase;
	testDatabase.add_table(testTable, "Test Table");

	list<String> SEL;
	SEL.push_back("Stock");
	SEL.push_back("Time");
	SEL.push_back("Sucks");
	SEL.push_back("Price");

	// Test Database Functionality
	Table queryResponse= testDatabase.query(SEL,"Test Table", "Price < 9");
	queryResponse.Print();

	map<String,String> testMap = queryResponse.get_columns();



	cout<<"\n\n";

	keep_window_open();

}
Exemple #2
0
void MetaDataConfig::parse_column(ElementTree::ElementPtr node, Table &table_meta)
{
    ElementTree::Elements::const_iterator child = node->children_.begin(),
        cend = node->children_.end();
    for (; child != cend; ++child) {
        ElementTree::ElementPtr col = *child;
        if (col->name_.compare(_T("column")))
            throw ParseError(String(_T("Unknown element '")) + col->name_
                    + _T("' found during parse of element 'table'"));
        table_meta.add_column(fill_column_meta(col));
    }
}