mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 02:59:27 +08:00
Update db.py
This commit is contained in:
+3
-16
@@ -42,25 +42,12 @@ class Sql():
|
||||
__debug = False
|
||||
|
||||
def __init__(self):
|
||||
# self.__DB_FILE = mw.getPanelDir()+'/data/panel.db'
|
||||
self.__DB_FILE = mw.getPanelDataDir()+'/panel.db'
|
||||
|
||||
def __getConnBak(self):
|
||||
try:
|
||||
if self.__DB_CONN == None:
|
||||
self.__DB_CONN = sqlite3.connect(self.__DB_FILE)
|
||||
self.__DB_CONN.text_factory = str
|
||||
except Exception as ex:
|
||||
print(getTracebackInfo())
|
||||
return "error: " + str(ex)
|
||||
self.__DB_FILE = mw.getPanelDir()+'/data/panel.db'
|
||||
# self.__DB_FILE = mw.getPanelDataDir()+'/panel.db'
|
||||
|
||||
def __getConn(self):
|
||||
# 取数据库对象
|
||||
if self.__DB_CONN is None:
|
||||
db_dir = os.path.dirname(self.__DB_FILE)
|
||||
if not os.path.exists(db_dir):
|
||||
os.makedirs(db_dir, exist_ok=True)
|
||||
try:
|
||||
if self.__DB_CONN == None:
|
||||
self.__DB_CONN = sqlite3.connect(self.__DB_FILE)
|
||||
self.__DB_CONN.text_factory = str
|
||||
except Exception as ex:
|
||||
|
||||
Reference in New Issue
Block a user