SQLite Forum

how to save results of
Login
The easiest way to use `sqlite3_exec()` is to replace it with `sqlite3_prepare_v2()`/`sqlite3_step()`/`sqlite3_column_*()`/`sqlite3_finalize()` calls so that you can read the data in the same place where you actually need to handle it:
```c
sqlite3_stmt *stmt;
const char *sql = "SELECT FrmNo,CapTime,CamTime from radar_1 WHERE FrmNo = ?";
int rc = sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
if (rc != SQLITE_OK) {
    print("error: ", sqlite3_errmsg(db));
    return;
}
sqlite3_bind_int(stmt, 1, 1);
while ((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
    int frm_no           = sqlite3_column_int (stmt, 0);
    const char *cap_time = sqlite3_column_text(stmt, 1);
    // ...
}
if (rc != SQLITE_DONE) {
    print("error: ", sqlite3_errmsg(db));
}
sqlite3_finalize(stmt);
```