def register(self, data): # Parse input into dict, so we know all values are correctly specified dat = dict() for x in range(0, len(data), 2): dat[data[x]] = data[x+1] # Begin with the process sql = SQL() query = "SELECT registrar(" + str(self.uid) + ", '" + dat['user'] + "','" + dat['password'] + "')" return sql.function(query)
def update_data(self, data): # Parse input into dict, so we know all values are correctly specified values = dict() for x in range(0, len(data), 2): values[data[x]] = data[x+1] # Begin with the process query = "SELECT actualiza(" + str(self.uid) if 'user' in values and 'password' in values: query += ", '" + values['user'] + "','" + values['password'] + "')" elif 'user' in values: query += ", '" + values['user'] + "', NULL)" elif 'password' in values: query += ", NULL, '" + values['password'] + "')" else: query += ", NULL, NULL)" sql = SQL() return sql.function(query)
def delete(self): query = 'SELECT eliminar(' + str(self.uid) + ')' sql = SQL() return sql.function(query)