Exemple #1
0
    def __init__(self, lpql=None, parent=None, name=None,
                 modal=False, wflag=0):
        QDialog.__init__(self, parent, name, modal, wflag)

        layout = QGridLayout(self)
        text = QTextEdit(self)
        if lpql is not None:
            sql,_ = lpath.translate2(lpql)
            stat =  " query tokenization: %6.3fs\n"
            stat += "    grammar parsing: %6.3fs\n"
            stat += "      chart parsing: %6.3fs\n"
            stat += "        translation: %6.3fs\n"
            stat = stat % lpath.get_profile()
            text.setText(str(sql))
            font = QFont("Courier")
            font.setBold(True)
            text.setCurrentFont(font)
            text.append("\n\n" + stat)
        layout.addWidget(text,0,0)

        buttons = QHBox(self)
        self.btnDismiss = QPushButton("&Dismiss", buttons)
        layout.addMultiCellWidget(buttons, 1,1,0,0)

        layout.setMargin(5)
        layout.setSpacing(5)
        buttons.setMargin(10)
        buttons.setSpacing(10)
        self.resize(600,300)

        self.connect(self.btnDismiss, SIGNAL("clicked()"), self.accept)
    def __init__(self,
                 lpql=None,
                 parent=None,
                 name=None,
                 modal=False,
                 wflag=0):
        QDialog.__init__(self, parent, name, modal, wflag)

        layout = QGridLayout(self)
        text = QTextEdit(self)
        if lpql is not None:
            sql, _ = lpath.translate2(lpql)
            stat = " query tokenization: %6.3fs\n"
            stat += "    grammar parsing: %6.3fs\n"
            stat += "      chart parsing: %6.3fs\n"
            stat += "        translation: %6.3fs\n"
            stat = stat % lpath.get_profile()
            text.setText(str(sql))
            font = QFont("Courier")
            font.setBold(True)
            text.setCurrentFont(font)
            text.append("\n\n" + stat)
        layout.addWidget(text, 0, 0)

        buttons = QHBox(self)
        self.btnDismiss = QPushButton("&Dismiss", buttons)
        layout.addMultiCellWidget(buttons, 1, 1, 0, 0)

        layout.setMargin(5)
        layout.setSpacing(5)
        buttons.setMargin(10)
        buttons.setSpacing(10)
        self.resize(600, 300)

        self.connect(self.btnDismiss, SIGNAL("clicked()"), self.accept)
Exemple #3
0
    def submitQuery(self, query):
        if not self.conn:
            #raise Exception("no database connection")
            return False

        self.currentSql, self.currentSql2 = lpath.translate2(query, self.tableName)
        sql = re.sub(r"\s(%s[0-9]+).\*\s(.*)$" % self.tableName,
                     r" distinct \1.sid, \1.tid \2 order by \1.sid, \1.tid",
                     self.currentSql, 1)
        self.cursor.execute(sql)
        return True
Exemple #4
0
    def submitQuery(self, query):
        if not self.conn:
            #raise Exception("no database connection")
            return False

        self.currentSql, self.currentSql2 = lpath.translate2(
            query, self.tableName)
        sql = re.sub(r"\s(%s[0-9]+).\*\s(.*)$" % self.tableName,
                     r" distinct \1.sid, \1.tid \2 order by \1.sid, \1.tid",
                     self.currentSql, 1)
        self.cursor.execute(sql)
        return True
Exemple #5
0
 def submitQuery(self, query):
     self.currentSql, self.currentSql2 = lpath.translate2(query, self.tableName)
     if self.currentSql is None:
         return False
     
     sql = re.sub(r"\s(%s[0-9]+).\*\s(.*)$" % self.tableName,
                  r" distinct \1.sid, \1.tid \2 order by \1.sid, \1.tid",
                  self.currentSql, 1)
     if self.prefetcher.running():
         self.prefetcher.stop()
         self.prefetcher.wait()
     if self.conn2 is not None:
         conn = self.conn2
     else:
         conn = self.conn
     self.prefetcher = Prefetcher(conn, sql, self.tableName,
                                  callback=self._prefetchCallback)
     self.prefetcher.start()
     return True
Exemple #6
0
    def submitQuery(self, query):
        self.currentSql, self.currentSql2 = lpath.translate2(
            query, self.tableName)
        if self.currentSql is None:
            return False

        sql = re.sub(r"\s(%s[0-9]+).\*\s(.*)$" % self.tableName,
                     r" distinct \1.sid, \1.tid \2 order by \1.sid, \1.tid",
                     self.currentSql, 1)
        if self.prefetcher.running():
            self.prefetcher.stop()
            self.prefetcher.wait()
        if self.conn2 is not None:
            conn = self.conn2
        else:
            conn = self.conn
        self.prefetcher = Prefetcher(conn,
                                     sql,
                                     self.tableName,
                                     callback=self._prefetchCallback)
        self.prefetcher.start()
        return True