diff --git a/工具v4/关键字筛选题号.py b/工具v4/关键字筛选题号.py index a5cf7f61..9241b0e4 100644 --- a/工具v4/关键字筛选题号.py +++ b/工具v4/关键字筛选题号.py @@ -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))