aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/predications.rb
Commit message (Collapse)AuthorAgeFilesLines
* Allow for handling quoted values in rangesSean Griffin2014-12-261-6/+14
| | | | | Since Active Record needs to eagerly cast values, we need to check for quoted infinity in our range handling
* Look for `Enumerable` rather than `Array` in predicatesSean Griffin2014-11-021-2/+2
| | | | | It's not quite duck typed, but it will allow us to pass in our own objects with additional logic (like type casting).
* Dry up building quoted nodes in predicationSean Griffin2014-10-271-15/+23
| | | | | Given that we are going to remove casting from Arel in the near future, having a single place nodes in predications will help.
* Deprecate passing ranges to `#in` and `#not_in`Sean Griffin2014-10-251-35/+49
| | | | | | | The goal of these methods should be to generate in nodes, not handle every possible permutation of more than one value. The `#between` and `#not_between` methods have been extracted, which better represent the semantics of handling ranges in SQL.
* Refactor `#in` and `#not_in`Sean Griffin2014-10-251-16/+20
| | | | | | | These methods duplicate a lot of logic from the other predications. We can just use those methods directly, and only build nodes with the same name in our method directly. We've already had one bug that came from building nodes directly, rather than using the proper predicate.
* `#not_in` with a range should respect proper precedenceSean Griffin2014-10-241-1/+1
| | | | | | | | | | | | | | | | | | Currently, doing ```ruby relation[:id].not_eq(4).and(relation[:id].not_in(1..3)) ``` will generate ```sql "id" != 4 AND "id" < 1 OR "id" > 3 ``` Which would incorrectly include records with an id of 4, as the OR statement has higher precidence than the AND statement. The `or` method on `Node` properly groups the statement in parenthesis.
* {Matches,DoesNotMatch} support the ESCAPE clauseTamir Duberstein2014-09-251-16/+17
|
* Fix lt & lteq don't accept most of values.bigxiang2014-08-231-6/+6
|
* Cleaned up some edge cases with infinity, the logic seems more intuitive nowNoah Lindner2014-06-011-18/+22
|
* build quoted nodes in factory methodsAaron Patterson2014-03-241-12/+16
|
* build quoted stringsAaron Patterson2014-03-241-7/+7
|
* add the casting node to the AST at build timeAaron Patterson2014-03-241-4/+4
| | | | | If we add the casting node to the ast at build time, then we can avoid doing the lookup at visit time.
* Support Float::INFINITY in rangesTim Pope2013-02-191-2/+18
|
* Add nodes for boolean constantsDaniel Cadenas2011-08-031-1/+0
| | | | | | | | | | | | This is useful for dynamically created predicates e.g: expr1 = table.create_false expr2 = table.create_false expr1 = create_a_predicate() if some_condition expr2 = create_another_predicate() if some_other_condition table.where(expr1.and(expr2))
* Move #as to AliasPredication, stop overriding Function's #as.Ernie Miller2011-04-291-4/+0
|
* Revert "Merged pull request #40 from gmile/master."Aaron Patterson2011-04-291-11/+1
| | | | | This reverts commit 490d6f98f8974c717ddca29df162f5f1ad48e094, reversing changes made to dd07005dceb6641214f7d1166f75acbd379fb570.
* Merged pull request #40 from gmile/master.Aaron Patterson2011-04-291-1/+11
|\ | | | | Passing nil in array generates improper SQL
| * Generate more sqlish queue.gmile2011-03-241-1/+11
| | | | | | | | | | | | | | | | Now, instead of the following SQL code: some_field IN (1, 2, NULL) Arel will generate the proper one: some_field IN (1, 2) OR IS NULL
* | Add support for ordering on expressionsArthur Taylor2011-04-281-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: lib/arel.rb lib/arel/attributes/attribute.rb lib/arel/nodes/infix_operation.rb lib/arel/nodes/named_function.rb Conflicts: lib/arel.rb lib/arel/attributes/attribute.rb
* | Improve performance of grouping_any/grouping_allErnie Miller2011-04-191-11/+4
|/
* Make as factory method convert alias name to SqlLiteralErnie Miller2011-03-121-1/+1
|
* Fix modification of input on *_any/*_all predicationsErnie Miller2011-02-081-0/+2
|
* stop using deprecated AND usageAaron Patterson2010-12-091-3/+3
|
* refactoring where, fixing subselectAaron Patterson2010-12-071-2/+2
|
* implementation for passing a subquery to #in and #not_inSven Fuchs2010-12-071-2/+2
|
* adding an AS nodeAaron Patterson2010-11-231-1/+5
|
* Fixed Ruby 1.8 performance regression for Nodes::In and Nodes::NotIn queries ↵Rolf Timmermans2010-11-181-7/+7
| | | | with very wide ranges that was caused by using Range#min and Range#max rather than Range#begin and Range#end. Ruby 1.8 uses Enumerable#min and Enumerable#max in Ranges, which calls to_a internally. It is not necessary to enumerate the range in order to construct the predicates. At the same time, an off-by-one error (failing test) with exclusive-end Ranges in Nodes::NotIn queries was fixed.
* Refactor predication methods to be available to SqlLiterals as well.Ernie Miller2010-10-271-0/+177