Clearing the Tables



These calls remove all the entries in the tables. On the first run, when the tables have just been created, that's a nonevent. On subsequent runs it brings us back to a clean slate.

You might find the notation unintuitive. If you prefer, you can write movies.where(true).remove() etc., to remind your readers that you are removing records that match a (vacuous) criterion, rather than the table itself.

As we go along, however, we'll grow accustomed to the idea that a table is a kind of a query [5] , and then intuitions might shift. Appending .where(true) to a table is like appending .where(true) to any other query: mere noise.

[5] In the course of writing the current program, we shall (a) build on a table just like we build on any other query (i.e. to make a bigger query), and (b) use a table's value mapper, just like we use any other query's value mapper. To complete the point, here's some code that (c) "executes" a table, just like executing any other query:

for (const movie &m: movies) std::cout << "Movie #" << << " is: " << m.title << std::end;

Just about the only thing you can't do with a table is call it a query. That is not its type. But I use the noun query, in normal font, to refer to anything we can use like a query, including a table.