Don't set m_first_query in statements that only retrieve from tmp tables
Don't set first query on queries that don't add data if there's no data

Some queries like `select_ways` will only add data to the tmp tables if
there is already data in them. Running these queries if there is no data
in the tmp tables has no effect and will always have no effect.
Rename m_first_query to m_tables_empty, a more accurate description
Merge pull request #73 from pnorman/not_first

Only set m_first_query on queries that could put initial data in the tables
Removed checked version of writeable bbox query.

This fixes issue #67.

Instead of checking whether the table is empty and using one of
two different queries, it now checks the assumption and uses the
unchecked query if it holds, throws an exception if it doesn't.

We shouldn't see the exception in real world usage, but it is
descriptive enough that someone experiencing it should be able to
file an issue about it.
Fix issue #49.

Took the opportunity to refactor out some common code between the
nodes, ways and relations calls. It now matches the rails
behaviour... The rails behaviour is pretty odd, but it is what it
is and we'll match it until it's fixed.