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(CompilerFlags)
include(RealmCore) include(RealmCore)
download_realm_core(0.95.5) download_realm_core(0.96.2)
include_directories(${REALM_CORE_INCLUDE_DIR} src external/pegtl) 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 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 erase_substring(size_t, size_t, size_t, size_t) { return true; }
bool optimize_table() { return true; } bool optimize_table() { return true; }
bool set_int_unique(size_t, size_t, int_fast64_t) { 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, StringData) { 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 // 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_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 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 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_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, StringData) { 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 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); } 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) if (start != end)
return start; 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 { struct FalseExpression : realm::Expression {
size_t find_first(size_t, size_t) const override { return not_found; } size_t find_first(size_t, size_t) const override { return realm::not_found; }
void set_table() override {} void set_base_table(const Table*) override {}
const Table* get_table() const override { return nullptr; } 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>; using KeyPath = std::vector<std::string>;
@ -236,9 +244,11 @@ void add_link_constraint_to_query(realm::Query &query,
switch (op) { switch (op) {
case Predicate::Operator::NotEqual: case Predicate::Operator::NotEqual:
query.Not(); query.Not();
case Predicate::Operator::Equal: case Predicate::Operator::Equal: {
query.links_to(prop_expr.prop->table_column, row_index); size_t col = prop_expr.prop->table_column;
query.links_to(col, query.get_table()->get_link_target(col)->get(row_index));
break; break;
}
default: default:
throw std::runtime_error("Only 'equal' and 'not equal' operators supported for object comparison."); 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); update_query_with_predicate(query, sub, arguments, schema, type);
} }
if (!pred.cpnd.sub_predicates.size()) { if (!pred.cpnd.sub_predicates.size()) {
query.and_query(new TrueExpression); query.and_query(std::unique_ptr<realm::Expression>(new TrueExpression));
} }
query.end_group(); query.end_group();
break; 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); update_query_with_predicate(query, sub, arguments, schema, type);
} }
if (!pred.cpnd.sub_predicates.size()) { if (!pred.cpnd.sub_predicates.size()) {
query.and_query(new FalseExpression); query.and_query(std::unique_ptr<realm::Expression>(new FalseExpression));
} }
query.end_group(); query.end_group();
break; break;
@ -471,16 +481,15 @@ void update_query_with_predicate(Query &query, const Predicate &pred, Arguments
break; break;
} }
case Predicate::Type::True: case Predicate::Type::True:
query.and_query(new TrueExpression); query.and_query(std::unique_ptr<realm::Expression>(new TrueExpression));
break; break;
case Predicate::Type::False: case Predicate::Type::False:
query.and_query(new FalseExpression); query.and_query(std::unique_ptr<realm::Expression>(new FalseExpression));
break; break;
default: default:
throw std::runtime_error("Invalid predicate type"); throw std::runtime_error("Invalid predicate type");
break;
} }
} }