def testBeginAbort(self): env = upscaledb.env() env.create("test.db", upscaledb.UPS_ENABLE_TRANSACTIONS) db = env.create_db(1) txn = upscaledb.txn(env) txn.abort() db.close()
def testBeginCommit(self): env = upscaledb.env() env.create("test.db", upscaledb.UPS_ENABLE_TRANSACTIONS) db = env.create_db(1) txn = upscaledb.txn(env) db.insert(txn, "key1", "value1") db.insert(txn, "key2", "value2") db.insert(txn, "key3", "value3") db.erase(txn, "key1") db.erase(txn, "key2") try: db.find(txn, "key1") except upscaledb.error, (errno, strerror): assert upscaledb.UPS_KEY_NOT_FOUND == errno
def testCursor(self): env = upscaledb.env() env.create("test.db", upscaledb.UPS_ENABLE_TRANSACTIONS) db = env.create_db(1) txn = upscaledb.txn(env) c = upscaledb.cursor(db, txn) c.insert("key1", "value1") c.insert("key2", "value2") c.insert("key3", "value3") c.find("key1") c.erase() try: c.find("key2") except upscaledb.error, (errno, strerror): assert upscaledb.UPS_KEY_NOT_FOUND == errno