/*
* call-seq:
* RangeQuery.new(field, options = {}) -> range_query
*
* Create a new RangeQuery on field +field+. There are two ways to build a
* range query. With the old-style options; +:lower+, +:upper+,
* +:include_lower+ and +:include_upper+ or the new style options; +:<+,
* +:<=+, +:>+ and +:>=+. The options' names should speak for themselves.
* In the old-style options, limits are inclusive by default.
*
* == Examples
*
* q = RangeQuery.new(:date, :lower => "200501", :include_lower => false)
* # is equivalent to
* q = RangeQuery.new(:date, :< => "200501")
* # is equivalent to
* q = RangeQuery.new(:date, :lower_exclusive => "200501")
*
* q = RangeQuery.new(:date, :lower => "200501", :upper => 200502)
* # is equivalent to
* q = RangeQuery.new(:date, :>= => "200501", :<= => 200502)
*/
static VALUE
frt_rq_init(VALUE self, VALUE rfield, VALUE roptions)
{
Query *q;
char *lterm = NULL;
char *uterm = NULL;
bool include_lower = false;
bool include_upper = false;
get_range_params(roptions, <erm, &uterm, &include_lower, &include_upper);
q = rq_new(frt_field(rfield),
lterm, uterm,
include_lower, include_upper);
Frt_Wrap_Struct(self, NULL, &frt_q_free, q);
object_add(q, self);
return self;
}