typedef struct imdbMovie { //! The imdb ID for the movie char * id; //! The title of the movie char * title; //! The year the movie was made char * year; //! The date of when the movie entry was last updated char * lu2d; } imdbMovie; int callback_Movie(void * data, int argc, char **argv, char **azColName) { imdbMovie *pMovie = (imdbMovie *)data; // 0 = id, 1 = title, 2 = year, 3 = lastUpdated if (argc != 4) { return 0; } pMovie->id = argv[0]; pMovie->title = argv[1]; pMovie->year = argv[2]; pMovie->lu2d = argv[3]; return 1; } int imdbDataBase_GetMovieFromID(char * id, imdbMovie * movie) { int rc; char queryInfo [44]; sprintf( queryInfo, "select * from imdbTitles where id = %s;", id ); rc = sqlite3_exec(imdbDB, queryInfo, callback_Movie, (void *)movie, 0); return rc; } int main() { char strIMDBID1[7]; char strIMDBID2[7]; imdbMovie * movie1 = new imdbMovie; imdbMovie * movie2 = new imdbMovie; imdbID1 = 813715; imdbID2 = 411008; sprintf(strIMDBID1,"%i",imdbID1); sprintf(strIMDBID2,"%i",imdbID2); /* If no Cache first imdbLookup the two movies */ printf("|%s|%s|",strIMDBID1,strIMDBID2); imdbDataBase_GetMovieFromID(strIMDBID1, movie1 ); imdbMoviePrint(movie1); imdbMoviePrint(movie2); imdbDataBase_GetMovieFromID(strIMDBID2, movie2 ); // now both movie1 and movie2 is the same :( imdbMoviePrint(movie1); imdbMoviePrint(movie2); }