autochoose WHERE & AND in queryeditline

This commit is contained in:
ccppi 2024-06-18 12:04:00 +02:00
parent 6b00dac638
commit a6f70d9492

View File

@ -33,6 +33,7 @@ class MainWindow(QMainWindow):
self.customcmd = '' self.customcmd = ''
self.cmd = '' self.cmd = ''
self.setWindowTitle("DB_Inspector") self.setWindowTitle("DB_Inspector")
self.isAWhere = False
self.layout = QVBoxLayout() self.layout = QVBoxLayout()
self.layout2 = QHBoxLayout() self.layout2 = QHBoxLayout()
@ -123,14 +124,23 @@ class MainWindow(QMainWindow):
print("cmd canton:", self.cmdCanton) print("cmd canton:", self.cmdCanton)
else: else:
self.cmdCanton = ' ' self.cmdCanton = ''
print("disable filter") print("disable fil§.ter")
# self.customSQL(self.cmd) # self.customSQL(self.cmd)
def queryEditLine(self): def queryEditLine(self):
self.cmd = self.EditQuery.text() self.cmd = self.EditQuery.text()
print(self.initcmd + self.cmdCanton +self.customcmd + self.cmd) if self.customcmd or self.cmd:
self.customSQL(self.initcmd+ self.cmdCanton + self.customcmd + self.cmd) if self.cmdCanton:
self.isAWhere = True
connectingstring = " AND "
else:
self.isAWhere = False
connectingstring = " WHERE "
else:
connectingstring = ' '
print(self.initcmd + self.cmdCanton +connectingstring +self.customcmd + self.cmd)
self.customSQL(self.initcmd+ self.cmdCanton + connectingstring + self.customcmd + self.cmd)
addFineFilter("../db/sqlite3.db","filters",self.customcmd + self.cmd) addFineFilter("../db/sqlite3.db","filters",self.customcmd + self.cmd)
def cell_clicked(self): def cell_clicked(self):
@ -274,7 +284,7 @@ class QueryWindow(QWidget):
if self.PApplyView.isChecked(): if self.PApplyView.isChecked():
self.view = self.CShowViews.currentText() self.view = self.CShowViews.currentText()
print("Selected View:",self.view) print("Selected View:",self.view)
window.initcmd = f"""SELECT * FROM '{self.view}'""" window.initcmd = f"""SELECT * FROM '{self.view}' """
print("window.initcmd:", window.initcmd) print("window.initcmd:", window.initcmd)
else: else:
window.initcmd = f"""SELECT * FROM jobs as b """ window.initcmd = f"""SELECT * FROM jobs as b """