Files
gajim-plugins/omemo/backend/db_helpers.py
Philipp Hörist 3c78b09fb2 [omemo] Refactor Plugin
- Adapt to nbxmpp supporting OMEMO
- Move python-axolotl code into backend folder
2019-02-12 00:00:12 +01:00

16 lines
424 B
Python

''' Database helper functions '''
def table_exists(db, name):
""" Check if the specified table exists in the db. """
query = """ SELECT name FROM sqlite_master
WHERE type='table' AND name=?;
"""
return db.execute(query, (name, )).fetchone() is not None
def user_version(db):
""" Return the value of PRAGMA user_version. """
return db.execute('PRAGMA user_version').fetchone()[0]