Arbol One <arbol...@gmail.com> wrote:
> Thank you for the prompt response. Now, using simple std::cout, could you
> show (give an example) of how to display (out streaming) the data extracted?

sqlite3* db;
sqlite3_open("db", &db);

sqlite_stmt* stmt;
sqlite3_prepare_v2(db, "select name, address, age from friend", -1, &stmt, 
NULL);

while (sqlite3_step(stmt) == SQLITE_ROW) {
  cout << (char*)sqlite3_column_text(stmt, 0) << ' ' << 
    (char*)sqlite3_column_text(stmt, 1) << ' ' <<
    sqlite3_column_int(stmt, 2) << endl;
}

sqlite3_finalize(stmt);
sqlite3_close(db);

Error handling is left as an exercise for the reader.
-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to