Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default support for "field IS NULL" condition #749

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

luku
Copy link
Contributor

@luku luku commented Oct 20, 2016

Problem:

echo  get_db()->getTable('Item')->getSelectForFindBy(array('item_type_id' => null));

Expected:

SELECT items.* FROM items WHERE item_type_id IS NULL

Actual:

SELECT items.* FROM items WHERE item_type_id = ?

And then you get error, because null is not passed as extra parameter into prepared statement.

I know, it won't fix calls like:

echo get_db()->getTable('Item')->getSelectForFindBy(array('item_type_id' => array(1, 2, null)));

Should I fix NULL in arrays as well? So it would produce SQL like: WHERE (item_type_id IN (1,2) OR item_type_id IS NULL)?

I'm not 100% sure if this change doesn't break it for other Omeka users calling parent::applySearchFilters() from their plugins, but I checked few plugins (ExhibitBuilder, SimplePages, HistoryLog) and it's OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant