def update(user): db.write( "UPDATE user SET username=\'{0}\', password=\'{1}\', email=\'{2}\' WHERE id={3}" .format(user.username, _md5_password(user.password), user.email, user._id)) return user
def update(user_settings): sql = "UPDATE user_settings SET user_id=\'{0}\', role_id=\'{1}\', language_1_id=\'{2}\', language_2_id\'{3}\' ".format( user_settings.userId, user_settings.roleId, user_settings.language1Id, user_settings.language2Id) db.write(sql) return user_settings
def update(translation): db.write( "UPDATE translation SET user_id={0}, folder_id={1}, language_1_id={2}, language_2_id={3}, phrase_1=\'{4}\', phrase_2=\'{5}\' WHERE id={6}" .format(translation._id, translation.user, translation.folder, translation.language_1, translation.language_2, translation.phrase_1, translation.phrase_2, translation._id)) return translation
def create(user): last_id = db.write( "INSERT INTO user (username,password,email) VALUES(\'{0}\',\'{1}\',\'{2}\')" .format(user.username, _md5_password(user.password), user.email)) user._id = last_id return user
def create(translation): last_id = db.write( "INSERT INTO translation (user_id,folder_id,language_1_id,language_2_id,phrase_1,phrase_2) VALUES ({0}, {1}, {2}, {3}, \'{4}\', \'{5}\')" .format(translation._id, translation.user, translation.folder, translation.language_1, translation.language_2, translation.phrase_1, translation.phrase_2)) translation._id = last_id return translation
def create(user_settings): sql = "INSERT INTO user_settings (user_id,role_id,language_1_id,language_2_id) VALUES (\'{0}\',\'{1}\',\'{2}\',\'{3}\') ".format( user_settings.userId, user_settings.roleId, user_settings.language1Id, user_settings.language2Id) last_id = db.write(sql) user_settings._id = last_id return user_settings
def delete(_id): db.write("DELETE FROM language WHERE id={0}".format(_id))
def update(language): db.write("UPDATE language SET name=\'{0}\' WHERE id={1}".format( language.name, language._id)) return language
def create(language): last_id = db.write("INSERT INTO language (name) VALUES (\'{0}\')".format( language.name)) language._id = last_id return language
def delete(userSettingsId): sql = "DELETE FROM user_settings WHERE id={0}".format(userSettingsId) db.write(sql) return True
def delete(_id): db.write("DELETE FROM user WHERE id={0}".format(str(_id))) return True
def delete(_id): db.write("DELETE FROM translation WHERE id={0}".format(_id))
def delete(_id): db.write("DELETE FROM folder WHERE id={0}".format(_id))
def update(folder): db.write("UPDATE folder SET name=\'{0}\' WHERE id={1}".format(folder.name, folder._id)) return folder
def create(folder): last_id=db.write("INSERT INTO folder (name) VALUES (\'{0}\')".format(folder.name)) folder._id=last_id return folder