## RhythmDBQueryResults

RhythmDBQueryResults — interface for receiving query results from RhythmDB

## Synopsis

                        RhythmDBQueryResults;
                        RhythmDBQueryResultsIface;
    void                rhythmdb_query_results_set_query    (RhythmDBQueryResults *results,
                                                             GPtrArray *query);
    void                rhythmdb_query_results_add_results  (RhythmDBQueryResults *results,
                                                             GPtrArray *entries);
    void                rhythmdb_query_results_query_complete
                                                            (RhythmDBQueryResults *results);

## Object Hierarchy

      GInterface
       +----RhythmDBQueryResults

## Known Implementations

RhythmDBQueryResults is implemented by RhythmDBQueryModel.

## Description

This is the interface that RhythmDB uses to report results of database queries. When running a query, it first calls rhythmdb_query_results_set_query, then passes entries matching the query to rhythmdb_query_results_add_results in batches, and finally calls rhythmdb_query_results_query_complete. There are no guarantees as to which threads the calls are made from.

## Details

### RhythmDBQueryResults

    typedef struct _RhythmDBQueryResults RhythmDBQueryResults;

### RhythmDBQueryResultsIface

    typedef struct {
    	GTypeInterface g_iface;

    	/* vtable */
    	void	(*set_query)		(RhythmDBQueryResults *results,
    				 	 GPtrArray *query);

    	void	(*add_results)		(RhythmDBQueryResults *results,
    				 	 GPtrArray *entries);

    	void 	(*query_complete)	(RhythmDBQueryResults *results);
    } RhythmDBQueryResultsIface;

### rhythmdb_query_results_set_query ()

    void                rhythmdb_query_results_set_query    (RhythmDBQueryResults *results,
                                                             GPtrArray *query);

When a new query is run, this method is invoked to give the object implementing this interface a chance to take a copy of the query criteria, so that it can evaluate the query for newly added or changed entries once the query is complete.

`results` : | the RhythmDBQueryResults implementation
`query` : | the new query

### rhythmdb_query_results_add_results ()

    void                rhythmdb_query_results_add_results  (RhythmDBQueryResults *results,
                                                             GPtrArray *entries);

Provides a new set of query results. References must be taken on the entries.

`results` : | the RhythmDBQueryResults implementation
`entries` : | GPtrArray containing RhythmDBEntry results

### rhythmdb_query_results_query_complete ()

    void                rhythmdb_query_results_query_complete
                                                            (RhythmDBQueryResults *results);

Called when the query is complete and all entries that match the query have been supplied to rhythmdb_query_results_add_results. If the object implementing this interface needs to identify newly added or changed entries that match the query, it needs to use the entry-added, entry-deleted and entry-changed signals from RhythmDB.

`results` : | the RhythmDBQueryResults