Dataset#grep now accepts :all_patterns, :all_columns, and :case_insensitive
options. Previously, grep would use a case sensitive search where it would
match if any pattern matched any column. These three options give you more
control over how the pattern matching will work:
dataset.grep([:a, :b], %w'%test% foo')
# WHERE ((a LIKE '%test%') OR (a LIKE 'foo')
# OR (b LIKE '%test%') OR (b LIKE 'foo'))
dataset.grep([:a, :b], %w'%foo% %bar%', :all_patterns=>true)
# WHERE (((a LIKE '%foo%') OR (b LIKE '%foo%'))
# AND ((a LIKE '%bar%') OR (b LIKE '%bar%')))
dataset.grep([:a, :b], %w'%foo% %bar%', :all_columns=>true)
# WHERE (((a LIKE '%foo%') OR (a LIKE '%bar%'))
# AND ((b LIKE '%foo%') OR (b LIKE '%bar%')))
dataset.grep([:a, :b], %w'%foo% %bar%',
:all_patterns=>true,:all_columns=>true)
# WHERE ((a LIKE '%foo%') AND (b LIKE '%foo%')
# AND (a LIKE '%bar%') AND (b LIKE '%bar%'))
dataset.grep([:a, :b], %w'%test% foo', :case_insensitive=>true)
# WHERE ((a ILIKE '%test%') OR (a ILIKE 'foo')
# OR (b ILIKE '%test%') OR (b ILIKE 'foo'))