Esempio n. 1
0
 def testMoveToNegative(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1)
   try:
     c = upscaledb.cursor()
   except TypeError:
     pass
   try:
     c = upscaledb.cursor("blah")
   except TypeError:
     pass
   try:
     c = upscaledb.cursor(db)
     c.move_to(upscaledb.UPS_CURSOR_FIRST)
   except upscaledb.error, (errno, string):
     assert upscaledb.UPS_KEY_NOT_FOUND  == errno
Esempio n. 2
0
 def testMoveToNegative(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1)
     try:
         c = upscaledb.cursor()
     except TypeError:
         pass
     try:
         c = upscaledb.cursor("blah")
     except TypeError:
         pass
     try:
         c = upscaledb.cursor(db)
         c.move_to(upscaledb.UPS_CURSOR_FIRST)
     except upscaledb.error, (errno, string):
         assert upscaledb.UPS_KEY_NOT_FOUND == errno
Esempio n. 3
0
 def testGetOverwrite(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1)
     c = upscaledb.cursor(db)
     try:
         c.overwrite("asdf")
     except upscaledb.error, (errno, string):
         assert upscaledb.UPS_CURSOR_IS_NIL == errno
Esempio n. 4
0
 def testGetOverwrite(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1)
   c = upscaledb.cursor(db)
   try:
     c.overwrite("asdf")
   except upscaledb.error, (errno, string):
     assert upscaledb.UPS_CURSOR_IS_NIL  == errno
Esempio n. 5
0
 def testGetRecordNegative(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1)
   c = upscaledb.cursor(db)
   try:
     c.get_record()
   except upscaledb.error, (errno, string):
     assert upscaledb.UPS_CURSOR_IS_NIL  == errno
Esempio n. 6
0
 def testGetRecordNegative(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1)
     c = upscaledb.cursor(db)
     try:
         c.get_record()
     except upscaledb.error, (errno, string):
         assert upscaledb.UPS_CURSOR_IS_NIL == errno
Esempio n. 7
0
 def testGetDuplicateCountNegative(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1, upscaledb.UPS_ENABLE_DUPLICATE_KEYS)
     c = upscaledb.cursor(db)
     try:
         c.get_duplicate_count()
     except upscaledb.error, (errno, string):
         assert upscaledb.UPS_CURSOR_IS_NIL == errno
Esempio n. 8
0
 def testClone(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1)
   c = upscaledb.cursor(db)
   clone = c.clone()
   c.close()
   clone.close()
   db.close()
Esempio n. 9
0
 def testClone(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1)
     c = upscaledb.cursor(db)
     clone = c.clone()
     c.close()
     clone.close()
     db.close()
Esempio n. 10
0
 def testGetDuplicateCountNegative(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1, upscaledb.UPS_ENABLE_DUPLICATE_KEYS)
   c = upscaledb.cursor(db)
   try:
     c.get_duplicate_count()
   except upscaledb.error, (errno, string):
     assert upscaledb.UPS_CURSOR_IS_NIL  == errno
Esempio n. 11
0
 def testFindNegative(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1)
     db.insert(None, "key1", "value1")
     db.insert(None, "key2", "value2")
     db.insert(None, "key3", "value3")
     c = upscaledb.cursor(db)
     try:
         c.find("key4")
     except upscaledb.error, (errno, string):
         assert upscaledb.UPS_KEY_NOT_FOUND == errno
Esempio n. 12
0
 def testCloneNegative(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1)
     c = upscaledb.cursor(db)
     try:
         clone = c.clone(13)
     except TypeError:
         pass
     c.close()
     db.close()
     env.close()
Esempio n. 13
0
 def testFindNegative(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1)
   db.insert(None, "key1", "value1")
   db.insert(None, "key2", "value2")
   db.insert(None, "key3", "value3")
   c = upscaledb.cursor(db)
   try:
     c.find("key4")
   except upscaledb.error, (errno, string):
     assert upscaledb.UPS_KEY_NOT_FOUND  == errno
Esempio n. 14
0
 def testCloneNegative(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1)
   c = upscaledb.cursor(db)
   try:
     clone = c.clone(13)
   except TypeError:
     pass
   c.close()
   db.close()
   env.close()
Esempio n. 15
0
 def testErase(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1)
     c = upscaledb.cursor(db)
     c.insert("key1", "value1")
     assert "key1" == c.get_key()
     assert "value1" == c.get_record()
     c.erase()
     try:
         c.find("key1")
     except upscaledb.error, (errno, string):
         assert upscaledb.UPS_KEY_NOT_FOUND == errno
Esempio n. 16
0
 def testErase(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1)
   c = upscaledb.cursor(db)
   c.insert("key1", "value1")
   assert "key1"  == c.get_key()
   assert "value1"  == c.get_record()
   c.erase()
   try:
     c.find("key1")
   except upscaledb.error, (errno, string):
     assert upscaledb.UPS_KEY_NOT_FOUND  == errno
Esempio n. 17
0
 def testMoveTo(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1)
     db.insert(None, "key1", "value1")
     db.insert(None, "key2", "value2")
     db.insert(None, "key3", "value3")
     c = upscaledb.cursor(db)
     c.move_to(upscaledb.UPS_CURSOR_FIRST)
     c.move_to(upscaledb.UPS_CURSOR_NEXT)
     c.move_to(upscaledb.UPS_CURSOR_LAST)
     c.close()
     db.close()
     env.close()
Esempio n. 18
0
 def testMoveTo(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1)
   db.insert(None, "key1", "value1")
   db.insert(None, "key2", "value2")
   db.insert(None, "key3", "value3")
   c = upscaledb.cursor(db)
   c.move_to(upscaledb.UPS_CURSOR_FIRST)
   c.move_to(upscaledb.UPS_CURSOR_NEXT)
   c.move_to(upscaledb.UPS_CURSOR_LAST)
   c.close()
   db.close()
   env.close()
Esempio n. 19
0
 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
Esempio n. 20
0
 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
Esempio n. 21
0
 def testInsertRecno(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1, upscaledb.UPS_RECORD_NUMBER32)
   c = upscaledb.cursor(db)
   c.insert(1, "value1")
   assert 1  == c.get_key()
   assert "value1"  == c.get_record()
   c.insert(2, "value2")
   c.insert(3, "value3")
   try:
     c.insert("1", "blah")
   except TypeError:
     pass
   c.close()
   db.close()
   env.close()
Esempio n. 22
0
 def testInsert(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1)
   c = upscaledb.cursor(db)
   c.insert("key1", "value1")
   assert "key1"  == c.get_key()
   assert "value1"  == c.get_record()
   c.insert("key3", "value3")
   assert "key3"  == c.get_key()
   assert "value3"  == c.get_record()
   c.insert("key2", "value2")
   assert "key2"  == c.get_key()
   assert "value2"  == c.get_record()
   c.close()
   db.close()
   env.close()
Esempio n. 23
0
 def testGetDuplicateCount(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1, upscaledb.UPS_ENABLE_DUPLICATE_KEYS)
     c = upscaledb.cursor(db)
     c.insert("key1", "value1")
     assert 1 == c.get_duplicate_count()
     c.insert("key1", "value2", upscaledb.UPS_DUPLICATE)
     assert 2 == c.get_duplicate_count()
     c.insert("key1", "value3", upscaledb.UPS_DUPLICATE)
     assert 3 == c.get_duplicate_count()
     c.erase()
     c.move_to(upscaledb.UPS_CURSOR_FIRST)
     assert 2 == c.get_duplicate_count()
     c.close()
     db.close()
     env.close()
Esempio n. 24
0
 def testEraseNegative(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1)
   c = upscaledb.cursor(db)
   try:
     c.erase(3)
   except TypeError:
     pass
   try:
     c.erase("a", "key2", "value2")
   except TypeError:
     pass
   try:
     c.erase()
   except upscaledb.error, (errno, string):
     assert upscaledb.UPS_CURSOR_IS_NIL  == errno
Esempio n. 25
0
 def testGetRecord(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1)
     db.insert(None, "key1", "value1")
     db.insert(None, "key2", "value2")
     db.insert(None, "key3", "value3")
     c = upscaledb.cursor(db)
     c.move_to(upscaledb.UPS_CURSOR_FIRST)
     assert "value1" == c.get_record()
     c.move_to(upscaledb.UPS_CURSOR_NEXT)
     assert "value2" == c.get_record()
     c.move_to(upscaledb.UPS_CURSOR_LAST)
     assert "value3" == c.get_record()
     c.close()
     db.close()
     env.close()
Esempio n. 26
0
 def testInsert(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1)
     c = upscaledb.cursor(db)
     c.insert("key1", "value1")
     assert "key1" == c.get_key()
     assert "value1" == c.get_record()
     c.insert("key3", "value3")
     assert "key3" == c.get_key()
     assert "value3" == c.get_record()
     c.insert("key2", "value2")
     assert "key2" == c.get_key()
     assert "value2" == c.get_record()
     c.close()
     db.close()
     env.close()
Esempio n. 27
0
 def testGetRecord(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1)
   db.insert(None, "key1", "value1")
   db.insert(None, "key2", "value2")
   db.insert(None, "key3", "value3")
   c = upscaledb.cursor(db)
   c.move_to(upscaledb.UPS_CURSOR_FIRST)
   assert "value1"  == c.get_record()
   c.move_to(upscaledb.UPS_CURSOR_NEXT)
   assert "value2"  == c.get_record()
   c.move_to(upscaledb.UPS_CURSOR_LAST)
   assert "value3"  == c.get_record()
   c.close()
   db.close()
   env.close()
Esempio n. 28
0
 def testGetDuplicateCount(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1, upscaledb.UPS_ENABLE_DUPLICATE_KEYS)
   c = upscaledb.cursor(db)
   c.insert("key1", "value1")
   assert 1  == c.get_duplicate_count()
   c.insert("key1", "value2", upscaledb.UPS_DUPLICATE)
   assert 2  == c.get_duplicate_count()
   c.insert("key1", "value3", upscaledb.UPS_DUPLICATE)
   assert 3  == c.get_duplicate_count()
   c.erase()
   c.move_to(upscaledb.UPS_CURSOR_FIRST)
   assert 2  == c.get_duplicate_count()
   c.close()
   db.close()
   env.close()
Esempio n. 29
0
 def testInsertRecno(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1, upscaledb.UPS_RECORD_NUMBER32)
     c = upscaledb.cursor(db)
     c.insert(1, "value1")
     assert 1 == c.get_key()
     assert "value1" == c.get_record()
     c.insert(2, "value2")
     c.insert(3, "value3")
     try:
         c.insert("1", "blah")
     except TypeError:
         pass
     c.close()
     db.close()
     env.close()
Esempio n. 30
0
 def testEraseNegative(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1)
     c = upscaledb.cursor(db)
     try:
         c.erase(3)
     except TypeError:
         pass
     try:
         c.erase("a", "key2", "value2")
     except TypeError:
         pass
     try:
         c.erase()
     except upscaledb.error, (errno, string):
         assert upscaledb.UPS_CURSOR_IS_NIL == errno
Esempio n. 31
0
 def testFindRecno(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1, upscaledb.UPS_RECORD_NUMBER64)
     db.insert(None, 1, "value1")
     db.insert(None, 2, "value2")
     db.insert(None, 3, "value3")
     c = upscaledb.cursor(db)
     c.find(1)
     assert 1 == c.get_key()
     assert "value1" == c.get_record()
     try:
         c.find("1")
     except TypeError:
         pass
     c.close()
     db.close()
     env.close()
Esempio n. 32
0
 def testFindRecno(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1, upscaledb.UPS_RECORD_NUMBER64)
   db.insert(None, 1, "value1")
   db.insert(None, 2, "value2")
   db.insert(None, 3, "value3")
   c = upscaledb.cursor(db)
   c.find(1)
   assert 1  == c.get_key()
   assert "value1"  == c.get_record()
   try:
     c.find("1")
   except TypeError:
     pass
   c.close()
   db.close()
   env.close()
Esempio n. 33
0
 def testInsertNegative(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1)
     c = upscaledb.cursor(db)
     try:
         c.insert(3, "value1")
     except TypeError:
         pass
     try:
         c.insert("a", "key2", "value2")
     except TypeError:
         pass
     try:
         c.insert()
     except TypeError:
         pass
     try:
         c.insert("key1", "value1")
         c.insert("key1", "value1")
     except upscaledb.error, (errno, string):
         assert upscaledb.UPS_DUPLICATE_KEY == errno
Esempio n. 34
0
 def testInsertNegative(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1)
   c = upscaledb.cursor(db)
   try:
     c.insert(3, "value1")
   except TypeError:
     pass
   try:
     c.insert("a", "key2", "value2")
   except TypeError:
     pass
   try:
     c.insert()
   except TypeError:
     pass
   try:
     c.insert("key1", "value1")
     c.insert("key1", "value1")
   except upscaledb.error, (errno, string):
     assert upscaledb.UPS_DUPLICATE_KEY  == errno
Esempio n. 35
0
 def testGetRecordSize(self):
     env = upscaledb.env()
     env.create("test.db")
     db = env.create_db(1, upscaledb.UPS_ENABLE_DUPLICATE_KEYS)
     c = upscaledb.cursor(db)
     c.insert("key1", "v")
     c.insert("key2", "va")
     c.insert("key3", "val")
     c.insert("key4", "valu", upscaledb.UPS_DUPLICATE)
     c.insert("key4", "value", upscaledb.UPS_DUPLICATE)
     c.move_to(upscaledb.UPS_CURSOR_FIRST)
     assert 1 == c.get_record_size()
     c.move_to(upscaledb.UPS_CURSOR_NEXT)
     assert 2 == c.get_record_size()
     c.move_to(upscaledb.UPS_CURSOR_NEXT)
     assert 3 == c.get_record_size()
     c.move_to(upscaledb.UPS_CURSOR_NEXT)
     assert 4 == c.get_record_size()
     c.move_to(upscaledb.UPS_CURSOR_NEXT)
     assert 5 == c.get_record_size()
     c.close()
     db.close()
     env.close()
Esempio n. 36
0
 def testGetRecordSize(self):
   env = upscaledb.env()
   env.create("test.db")
   db = env.create_db(1, upscaledb.UPS_ENABLE_DUPLICATE_KEYS)
   c = upscaledb.cursor(db)
   c.insert("key1", "v")
   c.insert("key2", "va")
   c.insert("key3", "val")
   c.insert("key4", "valu", upscaledb.UPS_DUPLICATE)
   c.insert("key4", "value", upscaledb.UPS_DUPLICATE)
   c.move_to(upscaledb.UPS_CURSOR_FIRST)
   assert 1 == c.get_record_size()
   c.move_to(upscaledb.UPS_CURSOR_NEXT)
   assert 2 == c.get_record_size()
   c.move_to(upscaledb.UPS_CURSOR_NEXT)
   assert 3 == c.get_record_size()
   c.move_to(upscaledb.UPS_CURSOR_NEXT)
   assert 4 == c.get_record_size()
   c.move_to(upscaledb.UPS_CURSOR_NEXT)
   assert 5 == c.get_record_size()
   c.close()
   db.close()
   env.close()