This is an example of how to use the Simple Database API. This example makes use of just about all of the functionality. The test consists of the following steps:
#include <SimpleDB.h> int main(int argc, char ** argv) { SimpleDB::IntColumn id; SimpleDB::StringColumn name(1000); SimpleDB::Column * columns[2] = {&id,&name}; try { SimpleDB::Database db("simpledb-examples"); SimpleDB::Query query(db); query.bind(columns, sizeof(columns)/sizeof(columns[0])); query.execute("SELECT contact_number, first_name FROM contacts LIMIT 10"); while(query.fetchRow()) std::cout << "ID: " << id << " NAME: " << name << std::endl; query.execute("SELECT contact_number, last_name FROM contacts LIMIT 5"); while(query.fetchRow()) { std::cout << "ID: " << id << " NAME: " << name << std::endl; std::cout << "Some math " << id.value()*5 << " " << name.value().append(" adfad") << std::endl; } } catch(const SimpleDB::Database::Exception& exception) { std::cerr << exception << std::endl; } catch(SimpleDB::Column::UnboundException) { std::cerr << "A column was not bound!" << std::endl; } return 0; }