Query's model primary field criterion.
Can be used only in a scope of IModelQuery.
Stands for creating criteria for the query.
This class provides straight forward way to define criteria and a bit (pretty huge one) of metaprogramming.
You can use standard method #c to create criteria for current table or for any other (passing it's name
as a 2nd argument):
Jennifer::Query["contacts"].join("addresses") { c("contact_id") == c("id", "contacts") }
Also you can use "magic" underscored methods to specify current table fields putting "_" before a name:
Jennifer::Query["contacts"].join("addresses") { _contact_id == c("id", "contacts") }
Obviously, you also can specify same way table name for the field. Just put "__" (double underscore) between table name and field name as well.
Jennifer::Query["contacts"].join("addresses") { _contact_id == _contacts__id }
Because of double underscore between symbols between field and table you can safely reference tables with "_".
Jennifer::Query["facebook_profiles"].join("addresses") { _profile_id == _facebook_profiles__id }
  Create "AbsFunction" function.
Creates ALL SQL statement.
Combines given first_condition, second_condition and all other conditions by AND operator.
Combines given array of conditions by AND operator.
Creates ANY SQL statement.
Create "AvgFunction" function.
Creates criterion for current table by given name name.
Creates criterion by given name name for the relation.
Cases expression to the given type.
Create "CeilFunction" function.
Returns a copy of self with all instance variables cloned.
Create :CoalesceFunction function.
Create "ConcatFunction" function.
Create "ConcatWsFunction" function.
Create "CountFunction" function.
Create "CurrentDateFunction" function.
Create "CurrentTimeFunction" function.
Create "CurrentTimestampFunction" function.
Create "FloorFunction" function.
Creates grouping for the given condition.
Alias for #g.
Create "LowerFunction" function.
Create "MaxFunction" function.
Create "MinFunction" function.
Create "NowFunction" function.
Combines given first_condition, second_condition and all other conditions by OR operator.
Combines given array of conditions by OR operator.
Query's model primary field criterion.
Create "RoundFunction" function.
Adds plain query query.
Adds plain query query.
Creates select star for table.
Create "SumFunction" function.
Create "UpperFunction" function.
Returns reference to the field in upsert operation.
Combines given first_condition, second_condition and all other conditions by XOR operator.
Combines given array of conditions by XOR operator.
Creates ALL SQL statement.
nested_query = Jennifer::Query["contacts"].select(:age).where { _tag == "phone" }
Jennifer::Query["contacts"].where { _age > all(nested_query) }
        Combines given first_condition, second_condition and all other conditions by AND operator.
All given conditions will be wrapped in Grouping.
User.all.where { and(_name.like("%on"), _age > 3) }
# WHERE (users.name LIKE '%on' AND users.age > 3)
        Combines given array of conditions by AND operator.
All given conditions will be wrapped in Grouping.
User.all.where { and([_name.like("%on"), _age > 3]) }
# WHERE (users.name LIKE '%on' AND users.age > 3)
        Creates ANY SQL statement.
nested_query = Jennifer::Query["addresses"].where { _main }.select(:contact_id)
Jennifer::Query["contacts"].where { _id == any(nested_query) }
        Creates criterion for current table by given name name.
Jennifer::Query["users"].where { c("id") } # => "users"."id"
        Creates criterion by given name name for the relation.
Cases expression to the given type.
type field is pasted as-is.
Jennifer::Query[""].select { [cast(sql("'100'", false), "integer").alias("field")] }
# => SELECT CAST('100' AS INTEGER) AS field
        Creates grouping for the given condition.
Jennifer::Query["users"].where { c1 & g(c2 | c3) }
        Combines given first_condition, second_condition and all other conditions by OR operator.
All given conditions will be wrapped in Grouping.
User.all.where { or(_name.like("%on"), _age > 3) }
# => WHERE (users.name LIKE '%on' OR users.age > 3)
        Combines given array of conditions by OR operator.
All given conditions will be wrapped in Grouping.
User.all.where { or([_name.like("%on"), _age > 3]) }
# WHERE (users.name LIKE '%on' OR users.age > 3)
        Adds plain query query.
If you need to wrap query set use_brackets to true.
Jennifer::Query[""].select { [sql("1", false)] } # => SELECT 1
Jennifer::Query[""].select { [sql("1")] }        # => SELECT (1)
Jennifer::Query[""].select { [sql("TIMESTAMP %s AT TIME ZONE %s", ["2001-02-16 20:38:40", "MST"], false)] }
# => SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'MST';
        Adds plain query query.
If you need to wrap query set use_brackets to true.
Jennifer::Query[""].select { [sql("1", false)] } # => SELECT 1
Jennifer::Query[""].select { [sql("1")] }        # => SELECT (1)
Jennifer::Query[""].select { [sql("TIMESTAMP %s AT TIME ZONE %s", ["2001-02-16 20:38:40", "MST"], false)] }
# => SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'MST';
        Creates select star for table.
Jennifer::Query["users"].select { [star("contacts")] } # => SELECT contacts.* FROM users
        Returns reference to the field in upsert operation.
Jennifer::Query["orders"].upsert(%w(name uid price), [["Order 1", 123, 3]], %w(uid)) do
  {:price => values(:price) + _price}
end
        Combines given first_condition, second_condition and all other conditions by XOR operator.
All given conditions will be wrapped in Grouping.
User.all.where { xor(_name.like("%on"), _age > 3) }
# => WHERE (users.name LIKE '%on' XOR users.age > 3)
        Combines given array of conditions by XOR operator.
All given conditions will be wrapped in Grouping.
User.all.where { xor([_name.like("%on"), _age > 3]) }
# WHERE (users.name LIKE '%on' XOR users.age > 3)