zoukankan      html  css  js  c++  java
  • 通过用户模型,对数据库进行增删改查操作。

    增加:
    db.session.add(user)
    db.session.commit()

    user = User(username = 'xiao777',password = 'xiao777')
    db.session.add(user)
    db.session.commit()
    查询:
    User.query.filter(User.username == 'mis1114').first()
    user = User.query.filter(User.username == 'xiao777').first()
    print(user.username,user.password)
    db.session.commit()


    修改:
    user.password = '111111'
    db.session.commit()
    user = User.query.filter(User.username == 'xiao777').first()
    user.password = '123456'
    db.session.commit()


    删除:
    db.session.delete(user)
    db.session.commit()
    user = User.query.filter(User.username == 'xiao777').first()
    db.session.delete(user)
    db.session.commit()
  • 相关阅读:
    Evensgn 的债务
    Passward
    拯救莫莉斯
    文艺平衡树
    Fliptile 翻格子游戏
    Making the Grade (bzoj1592)
    紧急疏散evacuate
    Password
    [NOIP2015]斗地主
    运输问题1
  • 原文地址:https://www.cnblogs.com/xiaojiaqi/p/7839355.html
Copyright © 2011-2022 走看看