本文整理汇总了Python中leap.soledad.client.sqlcipher.SQLCipherDatabase.open_database方法的典型用法代码示例。如果您正苦于以下问题:Python SQLCipherDatabase.open_database方法的具体用法?Python SQLCipherDatabase.open_database怎么用?Python SQLCipherDatabase.open_database使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leap.soledad.client.sqlcipher.SQLCipherDatabase
的用法示例。
在下文中一共展示了SQLCipherDatabase.open_database方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_open_database_with_factory
# 需要导入模块: from leap.soledad.client.sqlcipher import SQLCipherDatabase [as 别名]
# 或者: from leap.soledad.client.sqlcipher.SQLCipherDatabase import open_database [as 别名]
def test_open_database_with_factory(self):
temp_dir = self.createTempDir(prefix='u1db-test-')
path = temp_dir + '/existing.sqlite'
SQLCipherDatabase(path, PASSWORD)
db2 = SQLCipherDatabase.open_database(
path, PASSWORD, create=False,
document_factory=TestAlternativeDocument)
doc = db2.create_doc({})
self.assertTrue(isinstance(doc, SoledadDocument))
示例2: test_open_database_create
# 需要导入模块: from leap.soledad.client.sqlcipher import SQLCipherDatabase [as 别名]
# 或者: from leap.soledad.client.sqlcipher.SQLCipherDatabase import open_database [as 别名]
def test_open_database_create(self):
temp_dir = self.createTempDir(prefix='u1db-test-')
path = temp_dir + '/new.sqlite'
SQLCipherDatabase.open_database(path, PASSWORD, create=True)
db2 = SQLCipherDatabase.open_database(path, PASSWORD, create=False)
self.assertIsInstance(db2, SQLCipherDatabase)
示例3: create_database
# 需要导入模块: from leap.soledad.client.sqlcipher import SQLCipherDatabase [as 别名]
# 或者: from leap.soledad.client.sqlcipher.SQLCipherDatabase import open_database [as 别名]
def create_database(self, path):
"""Create a database at the given location."""
from leap.soledad.client.sqlcipher import SQLCipherDatabase
return SQLCipherDatabase.open_database(path, '123', True)
示例4: ensure_database
# 需要导入模块: from leap.soledad.client.sqlcipher import SQLCipherDatabase [as 别名]
# 或者: from leap.soledad.client.sqlcipher.SQLCipherDatabase import open_database [as 别名]
def ensure_database(self, path):
"""Ensure database at the given location."""
from leap.soledad.client.sqlcipher import SQLCipherDatabase
full_path = self._relpath(path)
db = SQLCipherDatabase.open_database(full_path, '123', False)
return db, db._replica_uid
示例5: open_database
# 需要导入模块: from leap.soledad.client.sqlcipher import SQLCipherDatabase [as 别名]
# 或者: from leap.soledad.client.sqlcipher.SQLCipherDatabase import open_database [as 别名]
def open_database(self, path):
"""Open a database at the given location."""
from leap.soledad.client.sqlcipher import SQLCipherDatabase
return SQLCipherDatabase.open_database(path, '123', False)