mirror of
https://github.com/Screenly/Anthias.git
synced 2026-01-16 01:58:32 -05:00
24 lines
445 B
Python
24 lines
445 B
Python
from __future__ import absolute_import
|
|
from __future__ import unicode_literals
|
|
import sqlite3
|
|
from contextlib import contextmanager
|
|
|
|
|
|
def conn(db):
|
|
return 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()
|