#define DATABASE_SQLITE #include // std::auto_ptr #include #include #include #include #include #include #include "database.hxx" #include "person.hxx" #include "person-odb.hxx" using namespace std; using namespace odb::core; using namespace odb; int main (int argc, char* argv[]) { try { auto_ptr db (new odb::sqlite::database ("test.db", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)); unsigned long john_id, jane_id, joe_id; // Create a few persistent person objects. // { person john ("prash", "Doe", 31); person jane ("Jake", "Doe", 32); person joe ("sim", "Dirt", 33); transaction t (db->begin ()); // Make objects persistent and save their ids for later use. // t.tracer (stderr_tracer); john_id = db->persist (john); jane_id = db->persist (jane); joe_id = db->persist (joe); t.commit (); } } catch (const odb::exception& e) { cerr << e.what () << endl; return 1; } }