當前位置: 首頁>>代碼示例>>Python>>正文


Python VFS.openSqlite3方法代碼示例

本文整理匯總了Python中fofix.core.VFS.openSqlite3方法的典型用法代碼示例。如果您正苦於以下問題:Python VFS.openSqlite3方法的具體用法?Python VFS.openSqlite3怎麽用?Python VFS.openSqlite3使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fofix.core.VFS的用法示例。


在下文中一共展示了VFS.openSqlite3方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: int

# 需要導入模塊: from fofix.core import VFS [as 別名]
# 或者: from fofix.core.VFS import openSqlite3 [as 別名]
    '''Turn a player name into a virtual path to the appropriate ini.'''
    return '%s/%s.ini' % (playerpath, name)

control0 = None
control1 = None
control2 = None
control3 = None
controlDict = {}
controllerDict = {}
playername = []
playerpref = []
playerstat = []

# Load the player database and check that it is fully initialized.
_SCHEMA_VERSION = 3
_playerDB = VFS.openSqlite3('%s/%s' % (playerpath, 'FoFiX-players.cache'))
_updateTables = 0
try:
    v = _playerDB.execute("SELECT `value` FROM `config` WHERE `key` = 'version'").fetchone()[0]
    if int(v) != _SCHEMA_VERSION:
        _updateTables = 2 #an old version. We don't want to just burn old tables.
except:
    _updateTables = 1 #no good table
if _updateTables > 0: #needs to handle old versions eventually.
    for tbl in _playerDB.execute("SELECT `name` FROM `sqlite_master` WHERE `type` = 'table'").fetchall():
        _playerDB.execute('DROP TABLE `%s`' % tbl)
    _playerDB.commit()
    _playerDB.execute('VACUUM')
    _playerDB.execute('CREATE TABLE `config` (`key` STRING UNIQUE, `value` STRING)')
    _playerDB.execute('CREATE TABLE `players` (`name` STRING UNIQUE, `lefty` INT, `drumflip` INT, `autokick` INT, `assist` INT, `twochord` INT, `necktype` INT, `neck` STRING, \
                   `part` INT, `difficulty` INT, `upname` STRING, `control` INT, `changed` INT, `loaded` INT)')
開發者ID:htvu,項目名稱:fofix,代碼行數:33,代碼來源:Player.py


注:本文中的fofix.core.VFS.openSqlite3方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。