24 lines
604 B
Python
24 lines
604 B
Python
import os
|
|
import sqlite3
|
|
|
|
db_path = '/usr/local/lib/bootbox/local.sqlite3'
|
|
|
|
class LocalDB(object):
|
|
def __init__(self, db_path = db_path):
|
|
self.db_path = db_path
|
|
self.conn = sqlite3.connect(self.db_path)
|
|
self.conn.row_factory = sqlite3.Row
|
|
self.cur = self.conn.cursor()
|
|
|
|
def getMenu(self, menu):
|
|
result = []
|
|
self.cur.execute('SELECT * FROM {0}'.format(menu))
|
|
for row in self.cur.fetchall():
|
|
result.append(dict(row))
|
|
return(result)
|
|
|
|
def close(self):
|
|
self.cur.close()
|
|
self.conn.close()
|
|
return()
|