From 0d72568519eb3a7d89c8d6704f5910604fa979c4 Mon Sep 17 00:00:00 2001 From: DaveTBlake Date: Fri, 29 Nov 2019 18:45:55 +0000 Subject: [PATCH] Process boolean fields with true/false parameter and (not) equal/contains operator like true/false operator --- xbmc/dbwrappers/DatabaseQuery.cpp | 16 ++++++++++++++++ xbmc/interfaces/json-rpc/schema/version.txt | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/xbmc/dbwrappers/DatabaseQuery.cpp b/xbmc/dbwrappers/DatabaseQuery.cpp index 2bed6ccf7f84f..08bea37e0c770 100644 --- a/xbmc/dbwrappers/DatabaseQuery.cpp +++ b/xbmc/dbwrappers/DatabaseQuery.cpp @@ -334,6 +334,22 @@ std::string CDatabaseQueryRule::GetWhereClause(const CDatabase &db, const std::s if (m_operator == OPERATOR_FALSE || m_operator == OPERATOR_TRUE) return GetBooleanQuery(negate, strType); + // Process boolean field with (not) EQUAL/CONTAINS "true"/"false" parameter too + if (GetFieldType(m_field) == BOOLEAN_FIELD && + (m_parameter[0] == "true" || m_parameter[0] == "false") && + (op == OPERATOR_CONTAINS || op == OPERATOR_EQUALS || op == OPERATOR_DOES_NOT_CONTAIN || + op == OPERATOR_DOES_NOT_EQUAL)) + { + if (m_parameter[0] == "false") + { + if (!negate.empty()) + negate.clear(); + else + negate = " NOT "; + } + return GetBooleanQuery(negate, strType); + } + // The BETWEEN operator is handled special if (op == OPERATOR_BETWEEN) { diff --git a/xbmc/interfaces/json-rpc/schema/version.txt b/xbmc/interfaces/json-rpc/schema/version.txt index 24cfa6c513194..30a426a93cafc 100644 --- a/xbmc/interfaces/json-rpc/schema/version.txt +++ b/xbmc/interfaces/json-rpc/schema/version.txt @@ -1 +1 @@ -JSONRPC_VERSION 10.6.1 +JSONRPC_VERSION 10.6.2