コード例 #1
0
 def login(self, nama, email, password):
     connection = DBConnect()
     query = "SELECT * from "+self.table + \
         " WHERE nama= '%s' and email= '%s' and password = '******'" % (
             nama, email, password)
     result = connection.executeRead(query)
     if not result:
         return True
     else:
         return False
コード例 #2
0
 def order(self, table, col, urutan):
     if urutan == 1:
         x = 'ASC'
     else:
         x = 'DESC'
     connection = DBConnect()
     query = "SELECT * from " + table + " ORDER BY " + col + ' ' + x
     # print(query)
     result = connection.executeRead(query)
     print(result)
コード例 #3
0
    def __init__(self, inputEmail=None):
        super().__init__("santri", [
            "nama", "email", "password", "alamat", "no_hp", "perguruan_tinggi", "prodi", "kamar_id"])

        # variable privet
        if inputEmail == None:
            pass
        else:
            self.__email = inputEmail
            connection = DBConnect()
            query = "SELECT password FROM " + self.table + \
                " WHERE email='%s'" % (self.__email)
            result = connection.executeRead(query)
            self.__password = result[0][0]
コード例 #4
0
 def jadwalDewe(self, ustad_id):
     connection = DBConnect()
     query = "SELECT * from " + "jadwal" + \
         " WHERE ustad_id= '%s'" % (ustad_id)
     result = connection.executeRead(query)
     # print(result)
     p = PrettyTable()
     x = []
     x.append('id')
     for column in self.column:
         x.append(column)
     p.field_names = x
     for row in result:
         listRow = list(row)
         listRow.pop(len(listRow)-1)
         listRow.pop(len(listRow)-1)
         p.add_row(listRow)
     print(p)
コード例 #5
0
 def read(self, role=None):
     connection = DBConnect()
     query = "SELECT * from " + self.table
     result = connection.executeRead(query)
     p = PrettyTable()
     x = []
     if role == None:
         x.append('id')
     for column in self.column:
         x.append(column)
     p.field_names = x
     for row in result:
         listRow = list(row)
         listRow.pop(len(listRow) - 1)
         listRow.pop(len(listRow) - 1)
         if role != None:
             listRow.pop(0)
         p.add_row(listRow)
     print(p)
コード例 #6
0
 def search(self, value):
     connection = DBConnect()
     query = "SELECT * from " + self.table + " WHERE "
     for i in range(len(self.column)):
         query += self.column[
             i] + " LIKE " + "'" + "%" + value + "%" + "'" + " OR "
     query = query[:-3]
     # print(query)
     result = connection.executeRead(query)
     p = PrettyTable()
     x = []
     x.append('id')
     for column in self.column:
         x.append(column)
     p.field_names = x
     for row in result:
         listRow = list(row)
         listRow.pop(len(listRow) - 1)
         listRow.pop(len(listRow) - 1)
         p.add_row(listRow)
     print(p)
コード例 #7
0
 def getID(self, email):
     connection = DBConnect()
     query = "SELECT * from " + self.table + " WHERE email= '%s'" % (email)
     result = connection.executeRead(query)
     return result[0][0]
コード例 #8
0
 def __call__(self, email):
     connection = DBConnect()
     query = "SELECT * from santri WHERE email= '%s'" % (email)
     result = connection.executeRead(query)
     print("Kamar dengan ID", str(result[0][8]),
           "Telah Melakukan Absen Jaga Pos")
コード例 #9
0
 def getID(cls, email):
     connection = DBConnect()
     query = "SELECT * from santri WHERE email= '%s'" % (email)
     result = connection.executeRead(query)
     # print(result)
     return str(result[0][8])
コード例 #10
0
 def getID(self):
     connection = DBConnect()
     query = "SELECT * from "+self.table + \
         " WHERE email= '%s'" % (self.__email)
     hasil = connection.executeRead(query)
     return hasil[0][0]
コード例 #11
0
 def getID(judul):
     connection = DBConnect()
     query = "SELECT * from kitab WHERE judul= '%s'" % (judul)
     result = connection.executeRead(query)
     return result[0][0]