Traverse the entire table and output the query results:
Int main (INT argc, char ** argv)
{
Int RC, I, ID, CID;
Char * Name;
Char * SQL;
Char * zerr;
Sqlite3 * dB; sqlite3_stmt * stmt;
SQL = "select ID, name, CID from episodes ";
// Open the database
Sqlite3_open ("test. DB", & dB );
// Compile the SQL statement
Sqlite3_prepare (dB, SQL, strlen (SQL), & stmt, null );
// Call the VM and run the vdbe Program
Rc = sqlite3_step (stmt );
While (rc = sqlite_row ){
Id = sqlite3_column_int (stmt, 0 );
Name = (char *) sqlite3_column_text (stmt, 1 );
Cid = sqlite3_column_int (stmt, 2 );
If (name! = NULL ){
Fprintf (stderr, "row: Id = % I, cid = % I, name = '% s' \ n", ID, CID, name );
} Else {
/* Field is null */
Fprintf (stderr, "row: Id = % I, cid = % I, name = NULL \ n", ID, CID );
}
Rc = sqlite3_step (stmt );
}
// Release resources
Sqlite3_finalize (stmt );
// Close the database
Sqlite3_close (db );
Return 0;
}