objectbox-c icon indicating copy to clipboard operation
objectbox-c copied to clipboard

in filter does not support obx_id

Open black-inc-service opened this issue 1 year ago • 0 comments

Describe the bug Cannot use in filter with obx_id

Basic info (please complete the following information):

  • ObjectBox version: 4.0.0
  • C++ version: 17
  • Reproducibility: always
  • OS: Ubuntu 22.04

To Reproduce Steps to reproduce the behavior:

  1. Create vector of obx_id
  2. Pass vector to "in" filter
  3. Compiler error

Expected behavior Should be able to handle obx_id

Code

database.fbs - example
table Device {
    /// objectbox:id
    id                        : ulong;
    active                    : bool; 
} 
std::vector<obx_id> requestIDs = {1, 2, 9};
tableDevice_.query().with(Device_::id.in(requestIDs)).build().findUniquePtrs(); // Fails to compile

std::vector<int64_t> requestIDs = {1, 2, 9};
tableDevice_.query().with(Device_::id.in(requestIDs)).build().findUniquePtrs(); // Is ok

This is caused as the template implementation for uint64_t is missing and obx_id is unsigned 64bit

objectbox.h
typedef uint64_t obx_id;

For our system we do not have big obx_id values bigger than 9,223,372,036,854,775,807 but a unsigned/signed conversion must be made or implement our own template in objectbox.hpp

black-inc-service avatar Jul 25 '24 10:07 black-inc-service