Ejemplo n.º 1
0
        def queryExecuted(t):
            queryModel.setResult(t.result, t.cursor)
            self.tableQueryResult.setModel(queryModel)

            if self.txtQuery.text().strip().lower().startswith('select'):
                self.labelQueryError.setText("%d rows returned" % t.cursor.rowcount)
            else:
                self.labelQueryError.setText("%d rows affected" % t.cursor.rowcount)

            self.labelQueryTime.setText("Query took %f sec" % t.elapsed_time)
            self.tableQueryResult.resizeColumnsToContents()
            self.tableQueryResult.resizeRowsToContents()

            warningsModel = QPySelectModel(self, self.db)
            warningsModel.setSelect("SHOW WARNINGS")
            warningsModel.select()
            self.tableWarnings.setModel(warningsModel)
            self.tableWarnings.resizeColumnsToContents()
            self.tableWarnings.resizeRowsToContents()

            height = 0
            for i in range(len(warningsModel._rows)):
                height += self.tableWarnings.rowHeight(i) + 2
            if height:
                height += 4
            self.tableWarnings.setMaximumHeight(height)

            queryTerminated()
Ejemplo n.º 2
0
        def queryExecuted(t):
            queryModel.setResult(t.result, t.cursor)
            self.tableQueryResult.setModel(queryModel)

            if self.txtQuery.text().strip().lower().startswith('select'):
                self.labelQueryError.setText("%d rows returned" %
                                             t.cursor.rowcount)
            else:
                self.labelQueryError.setText("%d rows affected" %
                                             t.cursor.rowcount)

            self.labelQueryTime.setText("Query took %f sec" % t.elapsed_time)
            self.tableQueryResult.resizeColumnsToContents()
            self.tableQueryResult.resizeRowsToContents()

            warningsModel = QPySelectModel(self, self.db)
            warningsModel.setSelect("SHOW WARNINGS")
            warningsModel.select()
            self.tableWarnings.setModel(warningsModel)
            self.tableWarnings.resizeColumnsToContents()
            self.tableWarnings.resizeRowsToContents()

            height = 0
            for i in range(len(warningsModel._rows)):
                height += self.tableWarnings.rowHeight(i) + 2
            if height:
                height += 4
            self.tableWarnings.setMaximumHeight(height)

            queryTerminated()
Ejemplo n.º 3
0
 def refresh(self):
     queryModel = QPySelectModel(self, self.connection)
     if self.processListInInfoSchema:
         where = "" if self.chkShowIdle.isChecked() else "WHERE STATE != ''"
         queryModel.setSelect("SELECT %s FROM information_schema.PROCESSLIST %s ORDER BY TIME DESC" % (",".join(self.processListColumns), where))
     else:
         queryModel.setSelect("SHOW FULL PROCESSLIST")
     queryModel.select()
     self.tableProcessList.setModel(queryModel)
     self.tableProcessList.resizeColumnsToContents()
Ejemplo n.º 4
0
 def refresh(self):
     queryModel = QPySelectModel(self, self.connection)
     if self.processListInInfoSchema:
         where = "" if self.chkShowIdle.isChecked() else "WHERE STATE != ''"
         queryModel.setSelect(
             "SELECT %s FROM information_schema.PROCESSLIST %s ORDER BY TIME DESC"
             % (",".join(self.processListColumns), where))
     else:
         queryModel.setSelect("SHOW FULL PROCESSLIST")
     queryModel.select()
     self.tableProcessList.setModel(queryModel)
     self.tableProcessList.resizeColumnsToContents()