class CatalogSqlite : Object {
Database db;
+ SList<Movie> result;
+ int results_waiting;
public delegate void ReceiveMovieFunction (string title, int year, int rating, int genres);
return 1;
}
+ result = new SList<Movie> ();
+ results_waiting = 0;
+
do {
Idle.add (query.callback);
yield;
movie.genres.field = stmt.column_int (3);
// TODO - depending on settings, this could be something else, like director info or runtime
movie.secondary = movie.genres.to_string ();
- callback (movie);
+ result.append (movie);
+ if (++results_waiting >= 10) {
+ callback (result);
+ result = new SList<Movie> ();
+ results_waiting = 0;
+ }
}
} while (rc == Sqlite.ROW);
+ if (results_waiting > 0)
+ callback (result);
+ result = new SList<Movie> ();
+
db.progress_handler (0, null);
return 0;
}