diff --git a/CMakeLists.txt b/CMakeLists.txt index 895d4d8c..e0441f49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake") include(CompilerFlags) include(RealmCore) -download_realm_core(0.95.5) +download_realm_core(0.96.2) include_directories(${REALM_CORE_INCLUDE_DIR} src external/pegtl) diff --git a/src/impl/transact_log_handler.cpp b/src/impl/transact_log_handler.cpp index b26d5895..cd9a8f9f 100644 --- a/src/impl/transact_log_handler.cpp +++ b/src/impl/transact_log_handler.cpp @@ -133,8 +133,9 @@ public: bool insert_substring(size_t, size_t, size_t, StringData) { return true; } bool erase_substring(size_t, size_t, size_t, size_t) { return true; } bool optimize_table() { return true; } - bool set_int_unique(size_t, size_t, int_fast64_t) { return true; } - bool set_string_unique(size_t, size_t, StringData) { return true; } + bool set_int_unique(size_t, size_t, size_t, int_fast64_t) { return true; } + bool set_string_unique(size_t, size_t, size_t, StringData) { return true; } + bool change_link_targets(size_t, size_t) { return true; } }; // Extends TransactLogValidator to also track changes and report it to the @@ -421,8 +422,8 @@ public: bool set_link(size_t col, size_t row, size_t, size_t) { return mark_dirty(row, col); } bool set_null(size_t col, size_t row) { return mark_dirty(row, col); } bool nullify_link(size_t col, size_t row, size_t) { return mark_dirty(row, col); } - bool set_int_unique(size_t col, size_t row, int_fast64_t) { return mark_dirty(row, col); } - bool set_string_unique(size_t col, size_t row, StringData) { return mark_dirty(row, col); } + bool set_int_unique(size_t col, size_t row, size_t, int_fast64_t) { return mark_dirty(row, col); } + bool set_string_unique(size_t col, size_t row, size_t, StringData) { return mark_dirty(row, col); } bool insert_substring(size_t col, size_t row, size_t, StringData) { return mark_dirty(row, col); } bool erase_substring(size_t col, size_t row, size_t, size_t) { return mark_dirty(row, col); } }; diff --git a/src/parser/query_builder.cpp b/src/parser/query_builder.cpp index af0c3d62..384191fb 100644 --- a/src/parser/query_builder.cpp +++ b/src/parser/query_builder.cpp @@ -41,16 +41,24 @@ struct TrueExpression : realm::Expression { if (start != end) return start; - return not_found; + return realm::not_found; + } + void set_base_table(const Table*) override {} + const Table* get_base_table() const override { return nullptr; } + std::unique_ptr clone(QueryNodeHandoverPatches*) const override + { + return std::unique_ptr(new TrueExpression(*this)); } - void set_table() override {} - const Table* get_table() const override { return nullptr; } }; struct FalseExpression : realm::Expression { - size_t find_first(size_t, size_t) const override { return not_found; } - void set_table() override {} - const Table* get_table() const override { return nullptr; } + size_t find_first(size_t, size_t) const override { return realm::not_found; } + void set_base_table(const Table*) override {} + const Table* get_base_table() const override { return nullptr; } + std::unique_ptr clone(QueryNodeHandoverPatches*) const override + { + return std::unique_ptr(new FalseExpression(*this)); + } }; using KeyPath = std::vector; @@ -236,9 +244,11 @@ void add_link_constraint_to_query(realm::Query &query, switch (op) { case Predicate::Operator::NotEqual: query.Not(); - case Predicate::Operator::Equal: - query.links_to(prop_expr.prop->table_column, row_index); + case Predicate::Operator::Equal: { + size_t col = prop_expr.prop->table_column; + query.links_to(col, query.get_table()->get_link_target(col)->get(row_index)); break; + } default: throw std::runtime_error("Only 'equal' and 'not equal' operators supported for object comparison."); } @@ -449,7 +459,7 @@ void update_query_with_predicate(Query &query, const Predicate &pred, Arguments update_query_with_predicate(query, sub, arguments, schema, type); } if (!pred.cpnd.sub_predicates.size()) { - query.and_query(new TrueExpression); + query.and_query(std::unique_ptr(new TrueExpression)); } query.end_group(); break; @@ -461,7 +471,7 @@ void update_query_with_predicate(Query &query, const Predicate &pred, Arguments update_query_with_predicate(query, sub, arguments, schema, type); } if (!pred.cpnd.sub_predicates.size()) { - query.and_query(new FalseExpression); + query.and_query(std::unique_ptr(new FalseExpression)); } query.end_group(); break; @@ -471,16 +481,15 @@ void update_query_with_predicate(Query &query, const Predicate &pred, Arguments break; } case Predicate::Type::True: - query.and_query(new TrueExpression); + query.and_query(std::unique_ptr(new TrueExpression)); break; case Predicate::Type::False: - query.and_query(new FalseExpression); + query.and_query(std::unique_ptr(new FalseExpression)); break; default: throw std::runtime_error("Invalid predicate type"); - break; } }