Nicolas Jäger wrote:
>     do
>     {
>       rc = sqlite3_step(stmt);
>       std::cout << sqlite3_column_text (stmt, 0) <<"," <<sqlite3_column_text 
> (stmt, 2) << std::endl;
>     } while(rc == SQLITE_ROW);

sqlite3_step() returns SQLITE_ROW when there is a row, or SQLITE_DONE
when there are no more rows, or an error code.  So after calling it, you
_must_ check the return value _before_ you try to read from the row:

    while ((rc = sqlite3_step(stmt)) == SQLITE_ROW)
    {
        ...sqlite3_column_...
    }
    if (rc != SQLITE_DONE)
        cerr << "error: " << sqlite3_errmsg(db) << endl;
    sqlite3_finalize(stmt);


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

Reply via email to