From 88730cf0a5dde7d18001a3c0598ff65c43f97ba7 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Thu, 19 Nov 2015 15:17:57 -0800 Subject: [PATCH] test and bug fixes for data queries --- parser/query_builder.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/parser/query_builder.cpp b/parser/query_builder.cpp index 353588e8..59425aaa 100644 --- a/parser/query_builder.cpp +++ b/parser/query_builder.cpp @@ -102,7 +102,7 @@ void add_bool_constraint_to_query(Query &query, Predicate::Operator operatorType void add_string_constraint_to_query(Query &query, Predicate::Operator op, Columns &&column, - std::string value) { + std::string &&value) { bool case_sensitive = true; switch (op) { case Predicate::Operator::BeginsWith: @@ -127,7 +127,7 @@ void add_string_constraint_to_query(Query &query, void add_string_constraint_to_query(realm::Query &query, Predicate::Operator op, - std::string value, + std::string &&value, Columns &&column) { bool case_sensitive = true; switch (op) { @@ -145,22 +145,22 @@ void add_string_constraint_to_query(realm::Query &query, void add_binary_constraint_to_query(Query &query, Predicate::Operator op, Columns &&column, - std::string value) { + std::string &&value) { switch (op) { case Predicate::Operator::BeginsWith: - query.begins_with(column.m_column, value); + query.begins_with(column.m_column, BinaryData(value)); break; case Predicate::Operator::EndsWith: - query.ends_with(column.m_column, value); + query.ends_with(column.m_column, BinaryData(value)); break; case Predicate::Operator::Contains: - query.contains(column.m_column, value); + query.contains(column.m_column, BinaryData(value)); break; case Predicate::Operator::Equal: - query.equal(column.m_column, value); + query.equal(column.m_column, BinaryData(value)); break; case Predicate::Operator::NotEqual: - query.not_equal(column.m_column, value); + query.not_equal(column.m_column, BinaryData(value)); break; default: throw std::runtime_error("Unsupported operator for binary queries."); @@ -173,10 +173,10 @@ void add_binary_constraint_to_query(realm::Query &query, Columns &&column) { switch (op) { case Predicate::Operator::Equal: - query.equal(column.m_column, value); + query.equal(column.m_column, BinaryData(value)); break; case Predicate::Operator::NotEqual: - query.not_equal(column.m_column, value); + query.not_equal(column.m_column, BinaryData(value)); break; default: throw std::runtime_error("Substring comparison not supported for keypath substrings.");