当前位置: 首页>>代码示例>>Python>>正文


Python DatabaseManager.link_save_state_to_performance方法代码示例

本文整理汇总了Python中database.DatabaseManager.link_save_state_to_performance方法的典型用法代码示例。如果您正苦于以下问题:Python DatabaseManager.link_save_state_to_performance方法的具体用法?Python DatabaseManager.link_save_state_to_performance怎么用?Python DatabaseManager.link_save_state_to_performance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在database.DatabaseManager的用法示例。


在下文中一共展示了DatabaseManager.link_save_state_to_performance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_save_state

# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import link_save_state_to_performance [as 别名]
def add_save_state(uuid):
    performance_uuid = request.form.get('performance_uuid')
    performance_time_index = request.form.get('performance_time_index')

    #   Save State File to DB
    fields = OrderedDict(
        description=request.form.get('description'),
        game_uuid=uuid,
        save_state_type=u'state',
        emulator_name=request.form.get('emulator'),
        emulator_version=request.form.get('emulator_version'),
        emt_stack_pointer=request.form.get('emt_stack_pointer'),
        stack_pointer=request.form.get('stack_pointer'),
        time=request.form.get('time'),
        created_on=None,
        created=datetime.datetime.now()
    )
    state_uuid = dbm.add_to_save_state_table(fts=True, **fields)

    #   Attach performance information if present
    if performance_uuid:
        #   Sometimes a state maybe linked to a performance without a specific index?
        #   Since we are adding a new state, it is always a state save action
        if performance_time_index:
            dbm.link_save_state_to_performance(state_uuid, performance_uuid, performance_time_index, 'save')
        else:
            dbm.link_save_state_to_performance(state_uuid, performance_uuid, 0, 'save')

    #   Retrieve save state information to get uuid and ignore blank fields
    save_state = dbm.retrieve_save_state(uuid=state_uuid)[0]
    return jsonify({'record': save_state})
开发者ID:gamecip,项目名称:citetool-editor,代码行数:33,代码来源:app.py

示例2: update_save_state

# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import link_save_state_to_performance [as 别名]
def update_save_state(uuid):
    update_fields = json.loads(request.form.get('update_fields'))

    #   if linking to a performance, do that and then throw away since GAME_SAVE_TABLE doesn't refer to performance
    if 'performance_uuid' in update_fields:
        performance_uuid = update_fields['performance_uuid']
        performance_time_index = update_fields['performance_time_index']
        action = update_fields['action']
        dbm.link_save_state_to_performance(uuid, performance_uuid, performance_time_index, action)
        del update_fields['performance_uuid']
        del update_fields['performance_time_index']
        del update_fields['action']

    #   make sure that there are still fields to update
    if len(update_fields.keys()) > 0:
        dbm.update_table(dbm.GAME_SAVE_TABLE, update_fields.keys(),update_fields.values(), ['uuid'], [uuid])
    return jsonify(dbm.retrieve_save_state(uuid=uuid)[0])
开发者ID:gamecip,项目名称:citetool-editor,代码行数:19,代码来源:app.py


注:本文中的database.DatabaseManager.link_save_state_to_performance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。