query_parse

@accepts(<varargs>)
@returns(RB.RhythmDBQuery)
def query_parse(None)

Creates a query from a list of criteria.

Most criteria consists of an operator (RB.RhythmDBQueryType), a property (RB.RhythmDBPropType) and the data to compare with. An entry matches a criteria if the operator returns true with the value of the entries property as the first argument, and the given data as the second argument.

Three types criteria are special. Passing RHYTHMDB_QUERY_END indicates the end of the list of criteria, and must be the last passes parameter.

The second special criteria is a subquery which is defined by passing RHYTHMDB_QUERY_SUBQUERY, followed by a query (GPtrArray). An entry will match a subquery criteria if it matches all criteria in the subquery.

The third special criteria is a disjunction which is defined by passing RHYTHMDB_QUERY_DISJUNCTION, which will make an entry match the query if it matches the criteria before the disjunction, the criteria after the disjunction, or both.

Example: rhythmdb_query_parse (db, RHYTHMDB_QUERY_SUBQUERY, subquery, RHYTHMDB_QUERY_DISJUNCTION RHYTHMDB_QUERY_PROP_LIKE, RHYTHMDB_PROP_TITLE, "cat", RHYTHMDB_QUERY_DISJUNCTION RHYTHMDB_QUERY_PROP_GREATER, RHYTHMDB_PROP_RATING, 2.5, RHYTHMDB_QUERY_PROP_LESS, RHYTHMDB_PROP_PLAY_COUNT, 10, RHYTHMDB_QUERY_END);

will create a query that matches entries: a) that match the query "subquery", or b) that have "cat" in their title, or c) have a rating of at least 2.5, and a play count of at most 10

It must be freed with rhythmdb_query_free()

None :

Returns :

a the newly created query.