本文整理匯總了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)