mirror of
https://github.com/Screenly/Anthias.git
synced 2026-01-01 10:48:18 -05:00
21 lines
373 B
Python
21 lines
373 B
Python
import sqlite3
|
|
from contextlib import contextmanager
|
|
import queries
|
|
|
|
conn = lambda db: sqlite3.connect(db, detect_types=sqlite3.PARSE_DECLTYPES)
|
|
|
|
|
|
@contextmanager
|
|
def cursor(connection):
|
|
cur = connection.cursor()
|
|
yield cur
|
|
cur.close()
|
|
|
|
|
|
@contextmanager
|
|
def commit(connection):
|
|
cur = connection.cursor()
|
|
yield cur
|
|
connection.commit()
|
|
cur.close()
|