Skip to content

Commit 02654a3

Browse files
Update C-API [4.3.1 -> 5.0.0]
1 parent 9515333 commit 02654a3

File tree

5 files changed

+97
-17
lines changed

5 files changed

+97
-17
lines changed

dev-doc/updating-c-library.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ Then manually:
9898
- Commit as
9999

100100
```text
101-
Update C-API [4.3.0 -> 4.3.1]
101+
Update C-API [4.3.1 -> 5.0.0]
102102
```

objectbox/lib/src/native/bindings/bindings.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ ObjectBoxC? _tryObjectBoxLibFile() {
9696
// libraries.
9797
// Library | C API | Database
9898
// ------------------------|-------|-----------------
99-
// C library 4.3.1 | 4.3.1 | 4.3.1-2025-07-28
100-
// Android library 4.3.1 | 4.3.1 | 4.3.1-2025-08-02
101-
// macOS/iOS library 4.4.1 | 4.3.1 | 4.3.1-2025-08-02
102-
var _obxCminMajor = 4;
103-
var _obxCminMinor = 3;
104-
var _obxCminPatch = 1;
99+
// C library 5.0.0-rc | 5.0.0 | 5.0.0-2025-09-27
100+
// Android library 5.0.1 | 5.0.0 | 5.0.0-2025-09-27
101+
// macOS/iOS library 5.0.0 | 5.0.0 | 5.0.0-2025-09-27
102+
var _obxCminMajor = 5;
103+
var _obxCminMinor = 0;
104+
var _obxCminPatch = 0;
105105
// Require minimum database version guaranteeing actual C API availability.
106-
var _obxDatabaseMinVersion = "4.3.1-2025-07-28";
106+
var _obxDatabaseMinVersion = "5.0.0-2025-09-27";
107107

108108
bool _isSupportedVersion(ObjectBoxC obxc) {
109109
// Require a minimum C API version

objectbox/lib/src/native/bindings/objectbox-sync.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "objectbox.h"
3535

3636
#if defined(static_assert) || defined(__cplusplus)
37-
static_assert(OBX_VERSION_MAJOR == 4 && OBX_VERSION_MINOR == 3 && OBX_VERSION_PATCH == 1, // NOLINT
37+
static_assert(OBX_VERSION_MAJOR == 5 && OBX_VERSION_MINOR == 0 && OBX_VERSION_PATCH == 0, // NOLINT
3838
"Versions of objectbox.h and objectbox-sync.h files do not match, please update");
3939
#endif
4040

@@ -201,6 +201,20 @@ OBX_C_API OBX_sync* obx_sync_urls(OBX_store* store, const char* server_urls[], s
201201
/// Stops and closes (deletes) the sync client, freeing its resources.
202202
OBX_C_API obx_err obx_sync_close(OBX_sync* sync);
203203

204+
/// Adds or replaces a sync filter variable value for the given name to the sync client.
205+
/// Eventually existing values for the same name are replaced.
206+
/// Client filter variables can be used in server-side sync filters to filter out objects that do not match the filter.
207+
/// Filter variables must be added before login, e.g. before obx_sync_start() or setting credentials.
208+
/// @param name non-NULL name of the filter variable
209+
/// @param value non-NULL value of the filter variable
210+
OBX_C_API obx_err obx_sync_filter_variables_put(OBX_sync* sync, const char* name, const char* value);
211+
212+
/// Removes a previously added sync filter variable value.
213+
OBX_C_API obx_err obx_sync_filter_variables_remove(OBX_sync* sync, const char* name);
214+
215+
/// Removes all previously added sync filter variable values.
216+
OBX_C_API obx_err obx_sync_filter_variables_remove_all(OBX_sync* sync);
217+
204218
/// Sets credentials to authenticate the client with the server.
205219
/// Any credentials that were set before are replaced;
206220
/// if you want to pass multiple credentials, use obx_sync_credentials_add() instead.

objectbox/lib/src/native/bindings/objectbox.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ extern "C" {
5151

5252
/// When using ObjectBox as a dynamic library, you should verify that a compatible version was linked using
5353
/// obx_version() or obx_version_is_at_least().
54-
#define OBX_VERSION_MAJOR 4
55-
#define OBX_VERSION_MINOR 3
56-
#define OBX_VERSION_PATCH 1 // values >= 100 are reserved for dev releases leading to the next minor/major increase
54+
#define OBX_VERSION_MAJOR 5
55+
#define OBX_VERSION_MINOR 0
56+
#define OBX_VERSION_PATCH 0 // values >= 100 are reserved for dev releases leading to the next minor/major increase
5757

5858
//----------------------------------------------
5959
// Common types
@@ -179,6 +179,8 @@ typedef enum {
179179
/// This is a free trial version; only applies to server builds (no trial builds for database and Sync clients).
180180
OBXFeature_Trial = 18,
181181

182+
/// Server-side filters to return individual data for each sync user (user-specific data).
183+
OBXFeature_SyncFilters = 19,
182184

183185
} OBXFeature;
184186

@@ -2121,7 +2123,7 @@ OBX_C_API obx_qb_cond obx_qb_less_or_equal_string(OBX_query_builder* builder, ob
21212123
OBX_C_API obx_qb_cond obx_qb_in_strings(OBX_query_builder* builder, obx_schema_id property_id,
21222124
const char* const values[], size_t count, bool case_sensitive);
21232125

2124-
/// For OBXPropertyType_StringVector - matches if at least one vector item equals the given value.
2126+
/// @deprecated Please use obx_qb_contains_element_string() instead.
21252127
OBX_C_API obx_qb_cond obx_qb_any_equals_string(OBX_query_builder* builder, obx_schema_id property_id, const char* value,
21262128
bool case_sensitive);
21272129

objectbox/lib/src/native/bindings/objectbox_c.dart

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4935,7 +4935,7 @@ class ObjectBoxC {
49354935
int Function(ffi.Pointer<OBX_query_builder>, int,
49364936
ffi.Pointer<ffi.Pointer<ffi.Char>>, int, bool)>();
49374937

4938-
/// For OBXPropertyType_StringVector - matches if at least one vector item equals the given value.
4938+
/// @deprecated Please use obx_qb_contains_element_string() instead.
49394939
int qb_any_equals_string(
49404940
ffi.Pointer<OBX_query_builder> builder,
49414941
int property_id,
@@ -8399,6 +8399,67 @@ class ObjectBoxC {
83998399
late final _sync_close =
84008400
_sync_closePtr.asFunction<int Function(ffi.Pointer<OBX_sync>)>();
84018401

8402+
/// Adds or replaces a sync filter variable value for the given name to the sync client.
8403+
/// Eventually existing values for the same name are replaced.
8404+
/// Client filter variables can be used in server-side sync filters to filter out objects that do not match the filter.
8405+
/// Filter variables must be added before login, e.g. before obx_sync_start() or setting credentials.
8406+
/// @param name non-NULL name of the filter variable
8407+
/// @param value non-NULL value of the filter variable
8408+
int sync_filter_variables_put(
8409+
ffi.Pointer<OBX_sync> sync1,
8410+
ffi.Pointer<ffi.Char> name,
8411+
ffi.Pointer<ffi.Char> value,
8412+
) {
8413+
return _sync_filter_variables_put(
8414+
sync1,
8415+
name,
8416+
value,
8417+
);
8418+
}
8419+
8420+
late final _sync_filter_variables_putPtr = _lookup<
8421+
ffi.NativeFunction<
8422+
obx_err Function(ffi.Pointer<OBX_sync>, ffi.Pointer<ffi.Char>,
8423+
ffi.Pointer<ffi.Char>)>>('obx_sync_filter_variables_put');
8424+
late final _sync_filter_variables_put =
8425+
_sync_filter_variables_putPtr.asFunction<
8426+
int Function(ffi.Pointer<OBX_sync>, ffi.Pointer<ffi.Char>,
8427+
ffi.Pointer<ffi.Char>)>();
8428+
8429+
/// Removes a previously added sync filter variable value.
8430+
int sync_filter_variables_remove(
8431+
ffi.Pointer<OBX_sync> sync1,
8432+
ffi.Pointer<ffi.Char> name,
8433+
) {
8434+
return _sync_filter_variables_remove(
8435+
sync1,
8436+
name,
8437+
);
8438+
}
8439+
8440+
late final _sync_filter_variables_removePtr = _lookup<
8441+
ffi.NativeFunction<
8442+
obx_err Function(ffi.Pointer<OBX_sync>,
8443+
ffi.Pointer<ffi.Char>)>>('obx_sync_filter_variables_remove');
8444+
late final _sync_filter_variables_remove = _sync_filter_variables_removePtr
8445+
.asFunction<int Function(ffi.Pointer<OBX_sync>, ffi.Pointer<ffi.Char>)>();
8446+
8447+
/// Removes all previously added sync filter variable values.
8448+
int sync_filter_variables_remove_all(
8449+
ffi.Pointer<OBX_sync> sync1,
8450+
) {
8451+
return _sync_filter_variables_remove_all(
8452+
sync1,
8453+
);
8454+
}
8455+
8456+
late final _sync_filter_variables_remove_allPtr =
8457+
_lookup<ffi.NativeFunction<obx_err Function(ffi.Pointer<OBX_sync>)>>(
8458+
'obx_sync_filter_variables_remove_all');
8459+
late final _sync_filter_variables_remove_all =
8460+
_sync_filter_variables_remove_allPtr
8461+
.asFunction<int Function(ffi.Pointer<OBX_sync>)>();
8462+
84028463
/// Sets credentials to authenticate the client with the server.
84038464
/// Any credentials that were set before are replaced;
84048465
/// if you want to pass multiple credentials, use obx_sync_credentials_add() instead.
@@ -10400,6 +10461,9 @@ abstract class OBXFeature {
1040010461

1040110462
/// This is a free trial version; only applies to server builds (no trial builds for database and Sync clients).
1040210463
static const int Trial = 18;
10464+
10465+
/// Server-side filters to return individual data for each sync user (user-specific data).
10466+
static const int SyncFilters = 19;
1040310467
}
1040410468

1040510469
/// Log level as passed to obx_log_callback.
@@ -11677,11 +11741,11 @@ class OBX_dart_finalizer extends ffi.Opaque {}
1167711741
typedef obx_dart_closer
1167811742
= ffi.NativeFunction<obx_err Function(ffi.Pointer<ffi.Void> native_object)>;
1167911743

11680-
const int OBX_VERSION_MAJOR = 4;
11744+
const int OBX_VERSION_MAJOR = 5;
1168111745

11682-
const int OBX_VERSION_MINOR = 3;
11746+
const int OBX_VERSION_MINOR = 0;
1168311747

11684-
const int OBX_VERSION_PATCH = 1;
11748+
const int OBX_VERSION_PATCH = 0;
1168511749

1168611750
const int OBX_ID_NEW = -1;
1168711751

0 commit comments

Comments
 (0)