Update to core 0.96.2

This commit is contained in:
Thomas Goyne 2016-02-23 14:53:03 -08:00
parent d87c41b352
commit bceec93a69
3 changed files with 28 additions and 18 deletions

View File

@ -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)

View File

@ -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); }
};

View File

@ -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<Expression> clone(QueryNodeHandoverPatches*) const override
{
return std::unique_ptr<Expression>(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<Expression> clone(QueryNodeHandoverPatches*) const override
{
return std::unique_ptr<Expression>(new FalseExpression(*this));
}
};
using KeyPath = std::vector<std::string>;
@ -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<realm::Expression>(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<realm::Expression>(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<realm::Expression>(new TrueExpression));
break;
case Predicate::Type::False:
query.and_query(new FalseExpression);
query.and_query(std::unique_ptr<realm::Expression>(new FalseExpression));
break;
default:
throw std::runtime_error("Invalid predicate type");
break;
}
}