mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-17 09:06:26 +00:00
bdash pr fixes
This commit is contained in:
parent
60b3b5d2fb
commit
ff532b47c4
2
list.hpp
2
list.hpp
@ -27,7 +27,7 @@ namespace realm {
|
||||
public:
|
||||
List(SharedRealm &r, const ObjectSchema &s, LinkViewRef l) : m_realm(r), m_object_schema(&s), m_link_view(l) {}
|
||||
|
||||
const ObjectSchema &object_schema() const { return *m_object_schema; }
|
||||
const ObjectSchema &get_object_schema() const { return *m_object_schema; }
|
||||
SharedRealm realm() { return m_realm; }
|
||||
|
||||
size_t size();
|
||||
|
@ -28,7 +28,7 @@ namespace realm {
|
||||
static inline Object create(ContextType ctx, SharedRealm realm, const ObjectSchema &object_schema, ValueType value, bool try_update);
|
||||
|
||||
SharedRealm realm() { return m_realm; }
|
||||
const ObjectSchema &object_schema() { return *m_object_schema; }
|
||||
const ObjectSchema &get_object_schema() { return *m_object_schema; }
|
||||
Row row() { return m_row; }
|
||||
|
||||
private:
|
||||
@ -309,19 +309,19 @@ namespace realm {
|
||||
template<typename ValueType, typename ContextType>
|
||||
void List::add(ContextType ctx, ValueType value)
|
||||
{
|
||||
add(NativeAccessor<ValueType, ContextType>::to_object_index(ctx, m_realm, value, object_schema().name, false));
|
||||
add(NativeAccessor<ValueType, ContextType>::to_object_index(ctx, m_realm, value, get_object_schema().name, false));
|
||||
}
|
||||
|
||||
template<typename ValueType, typename ContextType>
|
||||
void List::insert(ContextType ctx, ValueType value, size_t list_ndx)
|
||||
{
|
||||
insert(list_ndx, NativeAccessor<ValueType, ContextType>::to_object_index(ctx, m_realm, value, object_schema().name, false));
|
||||
insert(list_ndx, NativeAccessor<ValueType, ContextType>::to_object_index(ctx, m_realm, value, get_object_schema().name, false));
|
||||
}
|
||||
|
||||
template<typename ValueType, typename ContextType>
|
||||
void List::set(ContextType ctx, ValueType value, size_t list_ndx)
|
||||
{
|
||||
set(list_ndx, NativeAccessor<ValueType, ContextType>::to_object_index(ctx, m_realm, value, object_schema().name, false));
|
||||
set(list_ndx, NativeAccessor<ValueType, ContextType>::to_object_index(ctx, m_realm, value, get_object_schema().name, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ void add_binary_constraint_to_query(realm::Query &query,
|
||||
|
||||
void add_link_constraint_to_query(realm::Query &query,
|
||||
Predicate::Operator op,
|
||||
PropertyExpression &prop_expr,
|
||||
const PropertyExpression &prop_expr,
|
||||
size_t row_index) {
|
||||
precondition(prop_expr.indexes.empty(), "KeyPath queries not supported for object comparisons.");
|
||||
switch (op) {
|
||||
@ -260,12 +260,12 @@ void add_link_constraint_to_query(realm::Query &query,
|
||||
}
|
||||
}
|
||||
|
||||
auto link_argument(PropertyExpression &propExpr, parser::Expression &argExpr, Arguments &args)
|
||||
auto link_argument(const PropertyExpression &propExpr, const parser::Expression &argExpr, Arguments &args)
|
||||
{
|
||||
return args.object_index_for_argument(std::stoi(argExpr.s));
|
||||
}
|
||||
|
||||
auto link_argument(parser::Expression &argExpr, PropertyExpression &propExpr, Arguments &args)
|
||||
auto link_argument(const parser::Expression &argExpr, const PropertyExpression &propExpr, Arguments &args)
|
||||
{
|
||||
return args.object_index_for_argument(std::stoi(argExpr.s));
|
||||
}
|
||||
@ -376,7 +376,7 @@ auto value_of_type_for_query(TableGetter&& tables, Value&& value, Arguments &arg
|
||||
|
||||
template <typename A, typename B>
|
||||
void do_add_comparison_to_query(Query &query, const Schema &schema, const ObjectSchema &object_schema, Predicate::Operator op,
|
||||
PropertyExpression &expr, A &lhs, B &rhs, Arguments &args)
|
||||
const PropertyExpression &expr, A &lhs, B &rhs, Arguments &args)
|
||||
{
|
||||
auto type = expr.prop->type;
|
||||
switch (type) {
|
||||
@ -418,9 +418,9 @@ void do_add_comparison_to_query(Query &query, const Schema &schema, const Object
|
||||
}
|
||||
}
|
||||
|
||||
void add_comparison_to_query(Query &query, Predicate &pred, Arguments &args, const Schema &schema, const std::string &type)
|
||||
void add_comparison_to_query(Query &query, const Predicate &pred, Arguments &args, const Schema &schema, const std::string &type)
|
||||
{
|
||||
Predicate::Comparison &cmpr = pred.cmpr;
|
||||
const Predicate::Comparison &cmpr = pred.cmpr;
|
||||
auto t0 = cmpr.expr[0].type, t1 = cmpr.expr[1].type;
|
||||
auto object_schema = schema.find(type);
|
||||
if (t0 == parser::Expression::Type::KeyPath && t1 != parser::Expression::Type::KeyPath) {
|
||||
@ -436,7 +436,7 @@ void add_comparison_to_query(Query &query, Predicate &pred, Arguments &args, con
|
||||
}
|
||||
}
|
||||
|
||||
void update_query_with_predicate(Query &query, Predicate &pred, Arguments &arguments, const Schema &schema, const std::string &type)
|
||||
void update_query_with_predicate(Query &query, const Predicate &pred, Arguments &arguments, const Schema &schema, const std::string &type)
|
||||
{
|
||||
if (pred.negate) {
|
||||
query.Not();
|
||||
@ -484,7 +484,7 @@ void update_query_with_predicate(Query &query, Predicate &pred, Arguments &argum
|
||||
}
|
||||
}
|
||||
|
||||
void apply_predicate(Query &query, Predicate &predicate, Arguments &arguments, const Schema &schema, std::string objectType)
|
||||
void apply_predicate(Query &query, const Predicate &predicate, Arguments &arguments, const Schema &schema, const std::string &objectType)
|
||||
{
|
||||
update_query_with_predicate(query, predicate, arguments, schema, objectType);
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace realm {
|
||||
namespace query_builder {
|
||||
class Arguments;
|
||||
|
||||
void apply_predicate(Query &query, parser::Predicate &predicate, Arguments &arguments, const Schema &schema, std::string objectType);
|
||||
void apply_predicate(Query &query, const parser::Predicate &predicate, Arguments &arguments, const Schema &schema, const std::string &objectType);
|
||||
|
||||
class Arguments
|
||||
{
|
||||
|
@ -315,12 +315,12 @@ TableView Results::get_tableview()
|
||||
|
||||
Results Results::sort(realm::SortOrder&& sort) const
|
||||
{
|
||||
return Results(m_realm, object_schema(), get_query(), std::move(sort));
|
||||
return Results(m_realm, get_object_schema(), get_query(), std::move(sort));
|
||||
}
|
||||
|
||||
Results Results::filter(Query&& q) const
|
||||
{
|
||||
return Results(m_realm, object_schema(), get_query().and_query(std::move(q)), get_sort());
|
||||
return Results(m_realm, get_object_schema(), get_query().and_query(std::move(q)), get_sort());
|
||||
}
|
||||
|
||||
Results::UnsupportedColumnTypeException::UnsupportedColumnTypeException(size_t column, const Table* table)
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
SharedRealm get_realm() const { return m_realm; }
|
||||
|
||||
// Object schema describing the vendored object type
|
||||
const ObjectSchema &object_schema() const { return *m_object_schema; }
|
||||
const ObjectSchema &get_object_schema() const { return *m_object_schema; }
|
||||
|
||||
// Get a query which will match the same rows as is contained in this Results
|
||||
// Returned query will not be valid if the current mode is Empty
|
||||
@ -72,7 +72,7 @@ public:
|
||||
TableView get_tableview();
|
||||
|
||||
// Get the object type which will be returned by get()
|
||||
StringData get_object_type() const noexcept { return object_schema().name; }
|
||||
StringData get_object_type() const noexcept { return get_object_schema().name; }
|
||||
|
||||
// Get the size of this results
|
||||
// Can be either O(1) or O(N) depending on the state of things
|
||||
|
Loading…
x
Reference in New Issue
Block a user