blob: 44d6b96d3aeba002f841bbf6c87dfff4de232a3c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
import configparser
import sqlite3
class DbManager:
class __DbManager:
def __init__(self):
config = configparser.ConfigParser()
config.read("mach2.ini")
self.conn = sqlite3.connect(config["DEFAULT"]["database"])
def __str__(self):
return repr(self)
def execute(self, *args):
return self.conn.execute(*args)
def cursor(self):
return self.conn.cursor()
def commit(self):
return self.conn.commit()
def close(self):
return self.conn.close()
def rollback(self):
return self.conn.rollback()
def executemany(self, *args):
return self.conn.executemany(*args)
def executescript(self, *args):
return self.conn.executescript(*args)
def create_function(self, *args):
return self.conn.create_function(*args)
def create_aggregate(self, *args):
return self.conn.create_aggregate(*args)
def create_collation(self, *args):
return self.conn.create_collation(*args)
def interrupt(self):
return self.conn.interrupt()
instance = None
def __new__(cls):
if not DbManager.instance:
DbManager.instance = DbManager.__DbManager()
return DbManager.instance
|