Skip to content
Myr

Merge pull request #1235 from flowerhack/master

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Tweaked sqlite3 documentation

authored by Markus Unterwaditzer · committed by Markus Unterwaditzer · parents 54def62, bcba7eb · Browse files · 1 file+5 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−6 removed

  • other:+5 added−6 removed

1 file+5 added−6 removed

modified:docs/patterns/sqlite3.rst+5 added-6 removed
24 unmodified lines
25 db = getattr(g, '_database', None)26 if db is not None:27 db.close()2829All the application needs to do in order to now use the database is have30an active application context (which is always true if there is a request31in flight) or to create an application context itself. At that point the32``get_db`` function can be used to get the current database connection.33Whenever the context is destroyed the database connection will be34terminated.29Now, to use the database, the application must either have an active30application context (which is always true if there is a request in flight)31or create an application context itself. At that point the ``get_db``32function can be used to get the current database connection. Whenever the33context is destroyed the database connection will be terminated.3435Note: if you use Flask 0.9 or older you need to use36``flask._app_ctx_stack.top`` instead of ``g`` as the :data:`flask.g`37object was bound to the request and not application context.
100 unmodified lines