Exemple #1
0
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
Exemple #2
0
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
Exemple #3
0
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
Exemple #4
0
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
Exemple #5
0
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
Exemple #6
0
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
Exemple #7
0
def delete(_id):
    db.write("DELETE FROM language WHERE id={0}".format(_id))
Exemple #8
0
def update(language):
    db.write("UPDATE language SET name=\'{0}\' WHERE id={1}".format(
        language.name, language._id))

    return language
Exemple #9
0
def create(language):
    last_id = db.write("INSERT INTO language (name) VALUES (\'{0}\')".format(
        language.name))
    language._id = last_id
    return language
Exemple #10
0
def delete(userSettingsId):
    sql = "DELETE FROM user_settings WHERE id={0}".format(userSettingsId)

    db.write(sql)

    return True
Exemple #11
0
def delete(_id):
    db.write("DELETE FROM user WHERE id={0}".format(str(_id)))

    return True
Exemple #12
0
def delete(_id):
    db.write("DELETE FROM translation WHERE id={0}".format(_id))
Exemple #13
0
def delete(_id):
    db.write("DELETE FROM folder WHERE id={0}".format(_id))
Exemple #14
0
def update(folder):
    db.write("UPDATE folder SET name=\'{0}\' WHERE id={1}".format(folder.name, folder._id))

    return folder
Exemple #15
0
def create(folder):
    last_id=db.write("INSERT INTO folder (name) VALUES (\'{0}\')".format(folder.name))
    folder._id=last_id
    return folder