Stop &explain=true from corrupting all future queries.

This was using global variables and was broken since the conversion
to Flask.  Move this data to the flask.request object so it doesn't
affect other requests.
Use flask.g instead of flask.request to hold private per-request state.
Rename flask.g._explain to flask.g._should_explain
Move initialization of flask.g._should_explain and flask.g._sql_profile
to a before_request handler.
Make `explain=true` option use threadlocals rather than globals. Closes #112.