本文整理汇总了Python中money.Money.load_from_db方法的典型用法代码示例。如果您正苦于以下问题:Python Money.load_from_db方法的具体用法?Python Money.load_from_db怎么用?Python Money.load_from_db使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类money.Money
的用法示例。
在下文中一共展示了Money.load_from_db方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_from_db
# 需要导入模块: from money import Money [as 别名]
# 或者: from money.Money import load_from_db [as 别名]
def load_from_db(self, id):
rows = self.select_by_id('player', id)
for row in rows:
self.id = row[0]
self.name = row[1]
self.password = row[2]
self.email = row[3]
with self.connection:
cursor = self.connection.cursor()
cursor.execute(
"select achievement_id from achievement_player where player_id={}".format(id))
for achievement_player_row in cursor.fetchall():
achievement_id = achievement_player_row[0]
achievement = Achievement(self.connection)
self.achievements.append(achievement.load_from_db(achievement_id))
cursor.execute(
"select counter_id from counter_player where player_id={}".format(id))
for counter_player_row in cursor.fetchall():
counter_id = counter_player_row[0]
counter = Counter(self.connection)
self.counters.append(counter.load_from_db(counter_id))
cursor.execute("select id from money where player_id={}".format(id))
for money_row in cursor.fetchall():
money_id = money_row[0]
money = Money(self.connection)
money.load_from_db(money_id)
self.wallet[money.type] = money