示例#1
0
 def search(self, values):
     connect = DBconnector()
     query = "SELECT * from " + self.table + " WHERE "
     for i in range(len(self.column)):
         query += self.column[i] + " LIKE '%" + values + "%' OR "
     query = query[:-3]
     connect.execute(query)
示例#2
0
 def update(self, values, inputanID):
     connect = DBconnector()
     query = "UPDATE " + self.table + " SET "
     for i in range(len(self.column)):
         query += self.column[i] + "="
         query += "'" + values[i] + "',"
     query = query[:-1]
     query += " WHERE id ='%d'" % (inputanID)
     connect.execute(query)
     print("\t***UPDATE BERHASIL***")
示例#3
0
 def insert(self, values):
     connect = DBconnector()
     query = "INSERT INTO " + self.table + " ("
     for column in self.column:
         query += column + ","
     query = query[:-1]
     query += ") VALUES ("
     for val in values:
         query += "'" + val + "',"
     query = query[:-1]
     query += ")"
     connect.execute(query)
     print("\t***INSERT BERHASIL***")
示例#4
0
 def delete(self, inputanID):
     connect = DBconnector()
     query = "DELETE FROM " + self.table + " WHERE id = '%d'" % (inputanID)
     connect.execute(query)
     print("\t***DELETE BERHASIL***")