[feature/sql-bool-builder] Adding the IS operator to predicted operators

PHPBB3-13652
This commit is contained in:
brunoais 2015-03-16 11:31:51 +00:00
parent bc6ea5796d
commit 576eaa0cff
2 changed files with 19 additions and 1 deletions

View file

@ -866,6 +866,24 @@ abstract class driver implements driver_interface
break; break;
case 'IS_NOT':
$condition[1] = 'IS NOT';
// no break
case 'IS':
// If the value is NULL, the string of it is the empty string ('') which is not the intended result.
// this should solve that
if ($condition[2] === null)
{
$condition[2] = 'NULL';
}
$condition = implode(' ', $condition);
break;
default: default:
$condition = implode(' ', $condition); $condition = implode(' ', $condition);

View file

@ -153,7 +153,7 @@ class phpbb_boolean_processor_test extends phpbb_database_test_case
), ),
array('AND', array('AND',
array('ug.group_id', '=', 1), array('ug.group_id', '=', 1),
array('b.ban_id', 'IS NOT', NULL), array('b.ban_id', 'IS_NOT', NULL),
), ),
), ),
array('u.user_id', '=', 'ug.user_id'), array('u.user_id', '=', 'ug.user_id'),