#include #include #include int main() { StderrLog log; Database db("tutorial.db", &log); // sqlite3 specific Query q(db); q.get_result( "select player.*,resource.*,x.* from playerresource as x inner join player on " "x.player=player.num inner join resource on x.resource=resource.num"); while (q.fetch_row()) { db::Player player(&db, &q); db::Resource r(&db, &q, player.num_cols()); db::Playerresource x(&db, &q, player.num_cols() + r.num_cols()); printf("%s owns %ld piece%s of %s.\n", player.name.c_str(), x.amount, (x.amount == 1) ? "" : "s", r.name.c_str()); } q.free_result(); }