]> git.evergreen-ils.org Git - working/Evergreen.git/commit
QueryParser Driver: Protect against NULLs
authorThomas Berezansky <tsbere@mvlc.org>
Tue, 11 Sep 2012 19:02:59 +0000 (15:02 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 15 Feb 2013 20:39:48 +0000 (15:39 -0500)
commita4f5bc9dce8fb4065879db02559ef044d31ea888
tree338246ad278fd1bba90deddfe26dcb6b96d6a4fd
parent5aa5e26f4053e7193f7cf8f9b6845f027ce34917
QueryParser Driver: Protect against NULLs

mrd.attrs->'value' can return NULL. If this happens:

Checking that the value is within a range or list will work fine.
NEGATING that will not.

This is because:
AND NULL returns NULL
AND NOT (NULL) also returns NULL

The solution? Adjust things so we can wrap all the offending checks in a
COALESCE to false. Then if mrd.attrs->'value' is null we get a false.

In the process we move any and all negations to outside the COALESCE.

Also apply the same logic to the bib_source filter, not to mention
making it support being negated.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm