Work on native gui

This commit is contained in:
2025-11-07 14:42:05 +01:00
parent d5d754d596
commit e80a0688cc
3 changed files with 38 additions and 2 deletions
+15
View File
@@ -23,6 +23,21 @@ class Database():
self.dcur = self.conn.cursor(MySQLdb.cursors.DictCursor)
return True
def connect_local(self):
# connection via local unix socket
if self.conn:
return True
MySQLdb.paramstyle = 'pyformat'
try:
self.conn = MySQLdb.connect(host='localhost', db=self.schema,
unix_socket='/run/mysqld/mysqld.sock', charset='utf8')
except MySQLdb.Error as e:
print(e)
return False
self.cur = self.conn.cursor()
self.dcur = self.conn.cursor(MySQLdb.cursors.DictCursor)
return True
def disconnect(self):
self.cur.close()
self.dcur.close()