|
|
|
@ -94,10 +94,10 @@ class relForm(QtWidgets.QMainWindow):
|
|
|
|
|
compatibility.set_utf8_text(self.ui.txtResult, itm[0])
|
|
|
|
|
compatibility.set_utf8_text(self.ui.txtQuery, itm[1])
|
|
|
|
|
|
|
|
|
|
def execute(self):
|
|
|
|
|
'''Executes the query'''
|
|
|
|
|
if self.multiline:
|
|
|
|
|
def _run_multiline(self):
|
|
|
|
|
query = compatibility.get_py_str(self.ui.txtMultiQuery.toPlainText())
|
|
|
|
|
self.settings.setValue('multiline/query', query)
|
|
|
|
|
|
|
|
|
|
queries = query.split('\n')
|
|
|
|
|
|
|
|
|
|
for query in queries:
|
|
|
|
@ -116,15 +116,19 @@ class relForm(QtWidgets.QMainWindow):
|
|
|
|
|
expr = parser.parse(query)
|
|
|
|
|
result = eval(expr, self.relations)
|
|
|
|
|
self.relations[relname] = result
|
|
|
|
|
self.updateRelations() # update the list
|
|
|
|
|
self.selectedRelation = result
|
|
|
|
|
self.showRelation(self.selectedRelation)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print(str(e))
|
|
|
|
|
QtWidgets.QMessageBox.information(None, QtWidgets.QApplication.translate("Form", "Error"), u"%s\n%s" %
|
|
|
|
|
(QtWidgets.QApplication.translate("Form", "Check your query!"), str(e)))
|
|
|
|
|
return
|
|
|
|
|
break
|
|
|
|
|
self.updateRelations() # update the list
|
|
|
|
|
self.selectedRelation = result
|
|
|
|
|
self.showRelation(self.selectedRelation)
|
|
|
|
|
|
|
|
|
|
def execute(self):
|
|
|
|
|
'''Executes the query'''
|
|
|
|
|
if self.multiline:
|
|
|
|
|
return self._run_multiline()
|
|
|
|
|
|
|
|
|
|
#Single line query
|
|
|
|
|
query = compatibility.get_py_str(self.ui.txtQuery.text())
|
|
|
|
@ -277,6 +281,7 @@ class relForm(QtWidgets.QMainWindow):
|
|
|
|
|
def restore_settings(self):
|
|
|
|
|
# self.settings.value('session_name','default').toString()
|
|
|
|
|
self.setMultiline(self.settings.value('multiline','false')=='true')
|
|
|
|
|
self.ui.txtMultiQuery.setPlainText(self.settings.value('multiline/query',''))
|
|
|
|
|
|
|
|
|
|
def showSurvey(self):
|
|
|
|
|
if self.Survey == None:
|
|
|
|
|