Files
gajim-plugins/omemo/omemo/db_helpers.py
Philipp Hörist dabfbbf826 OMEMO GTK3 inital
2016-08-28 23:26:56 +02:00

16 lines
439 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]