prices.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Enibar 作者: ENIB 项目源码 文件源码
def set_multiple_values(prices):
    """ Update all prices with their new values
    Note: this function should be prefered when dealing with multiple prices at
    once for performance purposes.

    :param list prices: List of prices
    """
    with Database() as database:
        database.transaction()
        cursor = QtSql.QSqlQuery(database)
        cursor.prepare("UPDATE prices SET value=:value WHERE id=:id")
        for price in prices:
            cursor.bindValue(":id", price['id'])
            cursor.bindValue(":value", price['value'])
            cursor.exec_()

        database.commit()
        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号