修改一处过早连接数据库的bug
This commit is contained in:
parent
df227eedb7
commit
bdda463b52
|
|
@ -9,10 +9,6 @@ class MyWindow_sxth(QWidget,Ui_Form):
|
|||
self.database_name = database_name
|
||||
self.setupUi(self)
|
||||
self.conditions = []
|
||||
mydb = connect(hostname = db_host, port = db_port, username=db_user, pwd=db_pwd, db = self.database_name)
|
||||
mycursor = mydb.cursor()
|
||||
mycursor.execute("SELECT count(*) FROM problems WHERE NOT content REGEXP 'OBS';")
|
||||
self.lcdNumber_resCount.display(mycursor.fetchall()[0][0])
|
||||
self.bind()
|
||||
def setdbname(self,string):
|
||||
self.database_name = string
|
||||
|
|
@ -52,6 +48,10 @@ class MyWindow_sxth(QWidget,Ui_Form):
|
|||
text += f"字段 {field} 中{'没有' if flag_not else '有 '}{' 或 '.join([t.strip() for t in matchexp.split(',')])}\n"
|
||||
self.label_conditions.setText(text)
|
||||
def exec(self):
|
||||
mydb = connect(hostname = db_host, port = db_port, username=db_user, pwd=db_pwd, db = self.database_name)
|
||||
mycursor = mydb.cursor()
|
||||
mycursor.execute("SELECT count(*) FROM problems WHERE NOT content REGEXP 'OBS';")
|
||||
self.lcdNumber_resCount.display(mycursor.fetchall()[0][0])
|
||||
self.matchlist = MatchConditioninMariaDB(self.conditions,self.database_name)
|
||||
self.lcdNumber_resCount.display(len(self.matchlist))
|
||||
|
||||
|
|
|
|||
Reference in New Issue