Skip to content

Commit

Permalink
Process boolean fields with true/false parameter and (not) equal/cont…
Browse files Browse the repository at this point in the history
…ains operator like true/false operator
  • Loading branch information
DaveTBlake committed Nov 30, 2019
1 parent e4b94cb commit 0d72568
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions xbmc/dbwrappers/DatabaseQuery.cpp
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/json-rpc/schema/version.txt
@@ -1 +1 @@
JSONRPC_VERSION 10.6.1
JSONRPC_VERSION 10.6.2

0 comments on commit 0d72568

Please sign in to comment.