Ejemplo n.º 1
0
 def update(self, values, wherekey, keyword):
     connection = DBConnect()
     query = "UPDATE " + self.table + " SET " + self.column + " = " + str(
         values)
     query += " WHERE " + str(wherekey)
     query += " = " + str(keyword)
     connection.execute(query)
     print("Data berhasil di update")
 def setPassword(self, passwordBaru):
     self.__password = passwordBaru
     connection = DBConnect()
     query = "UPDATE "+self.table + \
         " SET password= '******' WHERE email = '%s'" % (
             self.__password, self.__email)
     connection.execute(query)
     print("===Password Berhasil Dirubah===")
Ejemplo n.º 3
0
 def insert(self, values):
     connection = DBConnect()
     query = """INSERT INTO """ + self.table + "("
     for column in self.column:
         query += column + ","
     query = query[:-1]
     query += ") VALUES ("
     for value in values:
         query += "'" + str(value) + "',"
     query = query[:-1]
     query += ")"
     connection.execute(query)
     print("Data berhasil dientrikan")
Ejemplo n.º 4
0
 def update(self, values, idInput):
     connection = DBConnect()
     query = """UPDATE """ + self.table + " SET "
     for i in range(len(self.column)):
         query += self.column[i] + "="
         if values[i] == None:
             query += "NULL,"
         else:
             query += "'" + values[i] + "',"
     query = query[:-1]
     query += " WHERE id ='%d'" % (idInput)
     # print(query)
     connection.execute(query)
     print("===Berhasil DiUpdate===")
Ejemplo n.º 5
0
 def create(self, values):
     connection = DBConnect()
     query = """INSERT INTO """ + self.table + " ("
     for column in self.column:
         query += column + ","
     query = query[:-1]
     query += ") VALUES ("
     for value in values:
         if value == None:
             query += "NULL,"
         else:
             query += "'" + value + "',"
     query = query[:-1]
     query += ")"
     # print(query)
     result = connection.execute(query)
     print("===Berhasil DiTambakan===")
Ejemplo n.º 6
0
 def insert_single(self, values):
     connection = DBConnect()
     query = "INSERT INTO " + self.table + "(" + self.column + ")" + " VALUES (\'%s\');"
     query = query % (values)
     connection.execute(query)
 def bayarSPP(self, nominal, email):
     connection = DBConnect()
     query = "INSERT INTO transaksi (tgl_pembayaran, nominal, jenis_transaksi, santri_id) VALUES ('%s',%s,'spp', %s)" % (
         Santri.tgl, nominal, self.getID())
     connection.execute(query)
     print("===Bayar SPP Berhasil===")
 def absenUstad(ustad, kitab):
     connection = DBConnect()
     query = "INSERT INTO absen_mengaji (tgl_absen, ustad_id, kitab_id) VALUES ('%s', %s, %s)" % (
         AbsenNgaji.tgl, ustad, kitab)
     connection.execute(query)
     print("===Absen berhasil===")
Ejemplo n.º 9
0
 def delete(self, idInput):
     connection = DBConnect()
     query = """DELETE FROM """ + self.table + " WHERE id = '%d'" % (
         idInput)
     connection.execute(query)