/usr/lib/ruby/vendor_ruby/sequel/extensions/filter_having.rb is in ruby-sequel 4.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | # The filter_having extension allows Dataset#filter, #and, #or
# and #exclude to operate on the HAVING clause if the dataset
# already has a HAVING clause, which was the historical behavior
# before Sequel 4. It is only recommended to use this for
# backwards compatibility.
#
# You can load this extension into specific datasets:
#
# ds = DB[:table]
# ds.extension(:filter_having)
#
# Or you can load it into all of a database's datasets, which
# is probably the desired behavior if you are using this extension:
#
# DB.extension(:filter_having)
module Sequel
module FilterHaving
# Operate on HAVING clause if HAVING clause already present.
def and(*cond, &block)
if @opts[:having]
having(*cond, &block)
else
super
end
end
# Operate on HAVING clause if HAVING clause already present.
def exclude(*cond, &block)
if @opts[:having]
exclude_having(*cond, &block)
else
super
end
end
# Operate on HAVING clause if HAVING clause already present.
def filter(*cond, &block)
if @opts[:having]
having(*cond, &block)
else
super
end
end
# Operate on HAVING clause if HAVING clause already present.
def or(*cond, &block)
if having = @opts[:having]
cond = cond.first if cond.size == 1
clone(:having => SQL::BooleanExpression.new(:OR, having, filter_expr(cond, &block)))
else
super
end
end
end
Dataset.register_extension(:filter_having, FilterHaving)
end
|