aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/nodes
Commit message (Collapse)AuthorAgeFilesLines
* Delete is not a NodeExpression, change parentKeenan Brock2017-12-051-3/+18
| | | | This requires a little cut and paste from the Binary node, but it is used in different parts of sql
* Introduce NodeExpression as parent of scalar nodesKeenan Brock2017-12-0513-25/+20
| | | | | SQL is very powerful. Many nodes can be used as a sub expression or query. grouping all of these possible nodes together
* Allow count nodes to have math functionsKevin Deisz2017-10-271-0/+2
|
* Type-castable attributes should not try to cast SqlLiteral nodesJames Coleman2017-09-291-1/+1
|
* Add missing hash, eql?, == to various node classesMaxime Lapointe2017-07-257-1/+22
| | | | | | | | | | | Some of the nodes classes are missing either one or many of the common comparison methods #hash, #eql? and #==. This makes comparision and working with the ast sometimes painful, as equality or operations likes array differences (which uses a hash behind the scene) produces unexpected results. A test has been added that ensures that every descendants of Node: * have all 3 methods * that all 3 methods were defined from the same class * that the class defining all 3 is also a descendant of Node, to avoid the default ones that rely on identity only
* Adjust `BindParam` as needed for ARSean Griffin2017-07-241-1/+5
| | | | | | | | | | We need `value` to have a writer for `StatementCache` to work when prepared statements are disabled. This is something I'd like to revert eventually, either by disabling that form of caching in that case or re-introducing something like the old `Bind` collector. The addition of `nil?` is to make `IS NULL` be inserted correctly, similar to what we already do with quoted and casted nodes
* Add a value field `Nodes::BindParam`Sean Griffin2017-07-211-1/+9
| | | | | | | | | | | | | | | | | | | | This is part of a greater refactoring to have the `BindParam` nodes hold onto their values. We want to generally keep the AST decoupled from what you're actually doing with those values, but ultimately the usage of `BindParam` is almost identical to how you'd use `Casted` or `Quoted`. Forcing consumers of Arel's API to maintain the bind values separately from the AST makes manipulating the AST essentially impossible, as you would need to perform a full walk of the AST to determine whether a given node contains bind parameters, and which value it maps to. By storing the value on the bind parameter directly, we can collect them in another AST pass (realistically it'll be part of the same pass that performs SQL construction for performance reasons). This will dramatically simplify AST manipulation for Rails or any other consumers that work with bind params. As part of this change I've removed the `BindVisitor`, which appears to be dead code, and had tests break from this change.
* Support INSERT with multiple valuesKir Shatrov2017-05-221-0/+13
|
* Revert "Merge pull request #482 from kirs/multiple-insert"Rafael Mendonça França2017-05-041-13/+0
| | | | | | | This reverts commit 6d105c7f891a14316eab47dfff3bf1b94f3204e7, reversing changes made to 437aa3a4bb8ad4f3f4eba299dbb1112852f9c7ac. This broke Active Record when the values are sql literals
* Support multiple insertsKir Shatrov2017-05-011-0/+13
|
* Enable frozen_string_literal in all files in arelRafael Mendonça França2017-02-1341-0/+41
|
* Fix Casted#hashMatthew Draper2016-07-281-1/+1
| | | | There is no @class variable.
* Add Support for GroupBy Cube, Rollup and Grouping Set Syntax for PostgreSQL ↵Mohammad Habbab2016-05-041-2/+6
| | | | Visitor
* added Casted#hashBert Bruynooghe2016-02-171-0/+4
|
* * Support for bitwise operations as infix operators. Tests included.Shahbaz Javeed2016-01-062-0/+55
| | | | | | | | | | | | | | | | | | | | | | *** Individual commit messages included below *** * Preliminary support for bitwise operations as infix operators. Tests to follow. * Added bitwise xor, shift left and shift right operators * Fixed the BitwiseOr class so it uses the :| operator instead of :& * All the methods for the bitwise operators in the Arel::Math module now wrap them up in Arel::Nodes::Grouping so the operation becomes isolated like addition and subtraction * Preliminary set of tests for the new operators * Updated README with examples of bitwise operations * Added a new UnaryOperation class which is a riff on the InfixOperation class * Added tests for UnaryOperation (inspired by InfixOperation tests) * Added the bitwise not (~) operator as a UnaryOperation * Added tests for the bitwise not operator * Added documentation for the bitwise not operator * Updated gemspec using `rake arel.gemspec`
* Add database specific string concatenationKeenan Brock2016-01-051-1/+6
|
* Implement CASE Conditional ExpressionFelix Bünemann2016-01-051-0/+57
|
* Merge pull request #381 from carsonreinke/function_orderRafael França2015-12-171-0/+1
|\ | | | | Add OrderPredications back into Nodes::Function
| * Add OrderPredications back into Nodes::Function (removed with deprecation of ↵Carson Reinke2015-07-231-0/+1
| | | | | | | | Expression)
* | Add case sensitive regexpKeenan Brock2015-12-052-2/+14
| | | | | | | | | | | | | | Explicitly declare if this is case sensitive or not currently postgres assumes case insensitive regexp no other databases support regexps
* | Add case sensitive matchKeenan Brock2015-12-051-1/+3
|/ | | | | | | Explicitly declare if this is case sensitive or not most implementation assume case sensitive postgres assumes case insensitive
* Move casted to its own fileVipul A M2015-05-311-0/+40
|
* Delete should respect 'limit'Bradford Folkens2015-02-231-0/+2
| | | | | Conflicts: lib/arel/visitors/to_sql.rb
* Change the interface of `having` to match that of `where`Sean Griffin2015-01-272-6/+5
| | | | | | These two clauses have nearly identical semantics with regards to how they would be constructed as an AST. It doesn't make sense for their interfaces to be separate.
* Implement equality for `BindParam`Sean Griffin2015-01-251-0/+3
| | | | | It is impossible to test equality of things constructing trees with bind params otherwise.
* Allow a type caster to be given to the `Arel::Table` objectSean Griffin2014-12-291-0/+8
| | | | | | | | | This will allow most consuming code to avoid the deprecation introduced in 008445d6fd5f825d9b445ac75a7be67f0f7ab52c. The only code which will be affected is code that is building the `Arel::Table` object manually, rather than calling `arel_table` on an Active Record class. Hopefully this case will be rare enough that we don't need to introduce any additional APIs to work around it.
* Remove `engine` from `TreeManager` and subclassesSean Griffin2014-11-291-4/+0
| | | | | | This constructor parameter was unused for everything except the convenience methods `to_sql` and `where_sql`. We can pass the engine into those methods directly.
* Add order to BindParams in the ToSql collectorSean Griffin2014-11-172-3/+6
| | | | | | | | | | | | This removes the need for us to do the re-ordering by walking the AST in ActiveRecord. We're using a block to communicate with the collector, since the collector needs to be the thing which knows about the index, while the visitor is the thing that needs to know the syntax. The BindParam needs to know about neither of these things, so it's been changed to stop being a subclass of SqlLiteral I could also see an alternative implementation using format strings if for some reason blocks cause a problem.
* Binary nodes should not generate the same hash as nodes of other classesSean Griffin2014-10-241-1/+1
|
* {Matches,DoesNotMatch} support the ESCAPE clauseTamir Duberstein2014-09-252-2/+14
|
* Remove unused @alias, being referenced in hashing.Vipul A M2014-09-161-1/+1
|
* `Extract#as` should not mutate the receiverTamir Duberstein2014-09-131-10/+3
| | | | Fixes https://github.com/rails/rails/issues/16913
* Windowing: Calling #rows or #range should assign framing only once.Alexander Staubo2014-06-221-2/+10
|
* Windowing support for PARTITION BY clause.Alexander Staubo2014-06-201-2/+13
|
* - Remove four year old deprecationVipul A M2014-06-011-5/+1
|
* Allow INSERT INTO <table> SELECT queriesJean Boussier2014-04-101-2/+5
|
* Merge branch 'master' into collectorAaron Patterson2014-04-083-0/+14
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | * master: remove order_clauses since we do not use it fix whitespace and unsupported method args Add Regexp and NotRegexp nodes for PostgreSQL Revert "Merge pull request #253 from corrupt952/master" flatten object.children in visit_Arel_Node_And Added right and full outer joins Conflicts: lib/arel/visitors/to_sql.rb lib/arel/visitors/visitor.rb
| * Add Regexp and NotRegexp nodes for PostgreSQLJames Le Cuirot2014-04-081-0/+2
| |
| * Added right and full outer joinsStephen Prater & Fire-Dragon-DoL2014-03-302-0/+12
| |
* | bind visitor working with collector objectAaron Patterson2014-04-081-1/+5
|/
* build quoted nodes in factory methodsAaron Patterson2014-03-241-2/+0
|
* add the casting node to the AST at build timeAaron Patterson2014-03-241-0/+2
| | | | | If we add the casting node to the ast at build time, then we can avoid doing the lookup at visit time.
* Remove deprecated Arel::ExpressionRafael Mendonça França2014-02-103-4/+0
|
* Add :encode_with for proper YAML serializationIvan Antropov2013-11-091-0/+4
|
* record who created the node when $DEBUG is trueAaron Patterson2013-05-201-1/+8
|
* call super from initializeAaron Patterson2013-05-178-0/+10
|
* Add equality to ALL THE THINGS (that matter)Ernie Miller2012-08-1814-2/+174
| | | | | | | | | | | | People are often trying to use ARel nodes inside ActiveRecord, and when they do so, lots of things can break, because ActiveRecord relies on Array#uniq and sometimes hash key equality to handle values that end up in wheres, havings, etc. By implementing equality for all the nodes, we should hopefully be able to prevent any nodes (even nodes containing other nodes) from failing an equality check they should otherwise pass, and alleviate many of these errors. Fixes #130
* Add Nodes::TableAlias#engineJon Leighton2012-07-131-0/+4
| | | | | Eventually #engine should go away, but until that time, this means that Table and Nodes::TableAlias can be used more interchangeably.
* Remove ArgumentError.Jon Leighton2012-07-131-2/+1
| | | | | | | | | | It is untested. There is no `@frame` variable. Presumably it is supposed to be `@framing`, but changing that shows that some of the tests *are* setting frame twice. I don't see why this level of strictness is necessary. If someone disagrees, they should add a test for this behaviour and make the other tests pass.
* Include Predications in GroupingErnie Miller2012-05-193-7/+7
| | | | | | Also, removed unused ordering.rb file, since it is identical to the one being created in unary.rb already, and isn't required anywhere.