Skip to content

Commit 547612c

Browse files
author
Ivan Dlugos
committed
update to c-api v0.6.0
1 parent daf32ab commit 547612c

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

objectbox/c.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from objectbox.version import Version
2020

2121
# This file contains C-API bindings based on the objectbox.h, linking to the 'objectbox' shared library
22-
required_version = "0.5.104"
22+
required_version = "0.6.0" # don't forget to update download-c-lib.py when upgrading to a newer version
2323

2424

2525
def shlib_name(library: str) -> str:
@@ -301,10 +301,10 @@ def c_voidp_as_bytes(voidp, size):
301301
obx_store_close = fn('obx_store_close', obx_err, [OBX_store_p])
302302

303303
# OBX_txn* (OBX_store* store);
304-
obx_txn_begin = fn('obx_txn_begin', OBX_txn_p, [OBX_store_p])
304+
obx_txn_write = fn('obx_txn_write', OBX_txn_p, [OBX_store_p])
305305

306306
# OBX_txn* (OBX_store* store);
307-
obx_txn_begin_read = fn('obx_txn_begin_read', OBX_txn_p, [OBX_store_p])
307+
obx_txn_read = fn('obx_txn_read', OBX_txn_p, [OBX_store_p])
308308

309309
# obx_err (OBX_txn* txn)
310310
obx_txn_close = fn('obx_txn_close', obx_err, [OBX_txn_p])
@@ -313,7 +313,7 @@ def c_voidp_as_bytes(voidp, size):
313313
obx_txn_abort = fn('obx_txn_abort', obx_err, [OBX_txn_p])
314314

315315
# obx_err (OBX_txn* txn);
316-
obx_txn_commit = fn('obx_txn_commit', obx_err, [OBX_txn_p])
316+
obx_txn_success = fn('obx_txn_success', obx_err, [OBX_txn_p])
317317

318318
# OBX_box* (OBX_store* store, obx_schema_id entity_id);
319319
obx_box = fn('obx_box', OBX_box_p, [OBX_store_p, obx_schema_id])

objectbox/transaction.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
@contextmanager
2020
def read(ob: 'ObjectBox'):
21-
tx = obx_txn_begin_read(ob._c_store)
21+
tx = obx_txn_read(ob._c_store)
2222
try:
2323
yield
2424
finally:
@@ -27,16 +27,9 @@ def read(ob: 'ObjectBox'):
2727

2828
@contextmanager
2929
def write(ob: 'ObjectBox'):
30-
tx = obx_txn_begin(ob._c_store)
31-
successful = False
30+
tx = obx_txn_write(ob._c_store)
3231
try:
3332
yield
34-
successful = True
33+
obx_txn_success(tx)
3534
finally:
36-
# this is better than bare `except:` because it doesn't catch stuff like KeyboardInterrupt
37-
if successful:
38-
obx_txn_commit(tx)
39-
else:
40-
obx_txn_abort(tx)
41-
4235
obx_txn_close(tx)

0 commit comments

Comments
 (0)