コード例 #1
0
def get_backupdb(dbfile, stderr=sys.stderr,
                 create_version=(SCHEMA_v2, 2), just_create=False):
    # Open or create the given backupdb file. The parent directory must
    # exist.
    try:
        (sqlite3, db) = get_db(dbfile, stderr, create_version, updaters=UPDATERS,
                               just_create=just_create, dbname="backupdb")
        return BackupDB_v2(sqlite3, db)
    except DBError, e:
        print >>stderr, e
        return None
コード例 #2
0
ファイル: backupdb.py プロジェクト: FiloSottile/tahoe-lafs
def get_backupdb(dbfile, stderr=sys.stderr, create_version=(SCHEMA_v2, 2), just_create=False):
    # Open or create the given backupdb file. The parent directory must
    # exist.
    try:
        (sqlite3, db) = get_db(
            dbfile, stderr, create_version, updaters=UPDATERS, just_create=just_create, dbname="backupdb"
        )
        return BackupDB_v2(sqlite3, db)
    except DBError, e:
        print >> stderr, e
        return None
コード例 #3
0
def get_magicfolderdb(dbfile, stderr=sys.stderr,
                      create_version=(SCHEMA_v1, 1), just_create=False):
    # Open or create the given backupdb file. The parent directory must
    # exist.
    try:
        (sqlite3, db) = get_db(dbfile, stderr, create_version,
                               just_create=just_create, dbname="magicfolderdb")
        if create_version[1] in (1, 2):
            return MagicFolderDB(sqlite3, db)
        else:
            print("invalid magicfolderdb schema version specified", file=stderr)
            return None
    except DBError as e:
        print(e, file=stderr)
        return None