Пример #1
0
    def getUserDetails(self):
        userValue = ui.lineEdit.text()
        userPass = ui.lineEdit_2.text()

        db = QSqlDatabase.addDatabase("QMYSQL")
        db.setHostName("127.0.0.1")
        db.setDatabaseName("envanter")
        db.setUserName("root")
        db.setPassword("mek")
        if (db.open() == False):
            QMessageBox.critical(None, "Database Error", db.lastError().text())
        query = QSqlQuery("SELECT * FROM kullanicilar WHERE username='******'")
        print query.result()
Пример #2
0
    def getUserDetails(self):
        userValue = ui.lineEdit.text();
        userPass  = ui.lineEdit_2.text();

        db = QSqlDatabase.addDatabase("QMYSQL")
        db.setHostName("127.0.0.1")
        db.setDatabaseName("envanter")
        db.setUserName("root")
        db.setPassword("mek")
        if (db.open()==False):
          QMessageBox.critical(None, "Database Error",
                    db.lastError().text())
        query = QSqlQuery ("SELECT * FROM kullanicilar WHERE username='******'")
        print query.result();
Пример #3
0
    def load_databases(self, srv_ki):
        """Load databases into tree node for server;  executes 'show databases;' or aslike """

        sql = "show databases;"
        query = QSqlQuery(QSqlDatabase.database(srv_ki))
        ok = query.exec_(sql)
        print ok, sql, query.result()

        # Get the parent node, ie the server node
        pItem = self.tree.findItems(srv_ki, Qt.MatchExactly, C.node)[0]

        ## Assumed value(0) is the table.. we need the defs (ie mysql case)
        while query.next():
            table_name = query.value(0).toString()
            nuItem = QTreeWidgetItem(pItem)
            nuItem.setText(C.node, table_name)
            #print table_name

        self.tree.setItemExpanded(pItem, True)
Пример #4
0
 def load_databases(self, srv_ki):
     """Load databases into tree node for server;  executes 'show databases;' or aslike """
     
     sql = "show databases;"
     query = QSqlQuery(QSqlDatabase.database(srv_ki))
     ok = query.exec_(sql)
     print ok, sql, query.result()
     
     # Get the parent node, ie the server node
     pItem = self.tree.findItems(srv_ki, Qt.MatchExactly, C.node)[0]
     
     ## Assumed value(0) is the table.. we need the defs (ie mysql case)
     while query.next():
         table_name =  query.value(0).toString()
         nuItem = QTreeWidgetItem(pItem)
         nuItem.setText(C.node, table_name)
         #print table_name
         
         
     self.tree.setItemExpanded(pItem, True)