-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaborting_update_tester.py
41 lines (34 loc) · 1.48 KB
/
aborting_update_tester.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from lstore.db import Database
from lstore.query import Query
from lstore.transaction import Transaction
db = Database()
db.open('aborting_delete_test')
test_table = db.create_table("test", 5, 0)
query = Query(test_table)
t = Transaction()
#t2 = Transaction()
t.add_query(query.insert, test_table, *[1, 1, 1, 1, 1])
#t2.add_query(query.update, test_table, 1, *[None, 1, 1, 2, 1])
#t2.add_query(query.select, test_table, 1, 0, [1,1,1,1,1])
t.add_query(query.insert, test_table, *[2, 1, 1, 1, 1])
t.add_query(query.insert, test_table, *[3, 1, 1, 1, 1])
# t.add_query(query.insert, test_table, *[1, 1, 1, 1, 1])
# t.add_query(query.insert, test_table, *[1, 1, 1, 1, 1])
# t.add_query(query.insert, test_table, *[2, 2, 2, 2, 2])
# t.add_query(query.insert, test_table, *[3, 3, 3, 3, 3])
# t.add_query(query.insert, test_table, *[4, 4, 4, 4, 4])
# t2.add_query(query.update, test_table, 3, *[None, 3, 2, 1, 0])
# t2.add_query(query.update, test_table, 2, *[None, 2, 1, 1, 4])
# t2.add_query(query.select, test_table, 2, 0, [1, 1, 1, 1, 1])
# t2.add_query(query.select_version, test_table, 2, 0, [1, 1, 1, 1, 1], 0)
# t2.add_query(query.sum, test_table, 0, 1, 0)
# t2.add_query(query.sum_version, test_table, 0, 1, 0, 0)
# t2.add_query(query.delete, test_table, 4)
t.add_query(query.insert, test_table, *[5, 5, 5, 5, 5])
# t.add_query(query.insert, test_table, *[5, 5, 5, 5, 5])
t.add_query(query.insert, test_table, *[6, 6, 6, 6, 6])
t.run()
# t2.run()
#print("after transaction")
# test_table.print_pg()
db.close()