PrevUpHomeNext

remove()

The remove() method is a wrapper for SQL's DELETE. In its simplest form, it removes all of a table's records, e.g.:

points.remove();

leaves the table points empty.

To remove only some of the records in the table, we can add a call to where() before remove(). E.g. to remove all points whose x is greater than 5:

points.where(points->x > 5.0f).remove();

Or we can use other querying features, as we did with update(), e.g.:

points.order(points->x).limit(3).remove();

to remove the points with the three lowest x values, or:

screens
.jump(movies, screens->current_movie_id == movies->id)
.remove();

to remove all the movies that are currently being screened.

The rule here is the same as for update(): the query's value mapper must be identical to, or a copy of, some table's value mapper. That lets quince know which table to remove records from (the one whose value mapper matches the query's), and also which records to remove (the ones whose values are equal to one or more of the values produced by the query).

If the query generates no records, then remove() does nothing. If you want to treat this condition specially, you can call one of the following instead of remove():

In all other respects remove_if_exists() and remove_existing() behave exactly like remove().


PrevUpHomeNext