"duro123" <rapid_sl...@yahoo.com> wrote
in message news:21533471.p...@talk.nabble.com
> Let's
> say I have a table persons in my db with fields: name (varchar),
> surname(varchar), something (float). And let's say I write a sql
> statement: select * from persons where name='some_name' and
> surname='some_surname'. The thing is I want to store all the data
> from the row in c++ variables so I can use them easily. How can I do
> that?

sqlite3* db; // initialized with sqlite3_open
sqlite3* stmt;
sqlite3_prepare_v2(db,
    "select name, surname, something from persons"
    " where name='some_name' and surname='some_surname';",
    -1, &stmt, NULL);

while (sqlite3_step(stmt) == SQLITE_ROW) {
    string name = (char*)sqlite3_column_text(stmt, 0);
    string surname = (char*)sqlite3_column_text(stmt, 1);
    double something = sqlite3_column_double(stmt, 2);
    Process(name, surname, something);
}

sqlite3_finalize(stmt);

Igor Tandetnik 



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

Reply via email to