aboutsummaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* BigDecimal.new is deprecated in Ruby 2.5Yasuo Honda2018-01-071-1/+1
| | | | Refer https://github.com/ruby/bigdecimal/pull/86
* require 'date' to address for Ruby 2.5Yasuo Honda2018-01-071-0/+2
| | | | Address #517
* Merge pull request #481 from lautis/lateralAaron Patterson2017-12-281-0/+14
|\ | | | | Lateral expressions for PostgreSQL
| * PostgreSQL lateral expressionsVille Lautanala2017-04-251-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Support for PostgreSQL lateral expressions. This is treated as an unary function applied to a query expression. Lateral is a separate function to provide interoperability with aliases and unions. These are also separate node types that wrap SelectStatements. The lateral option would need to be implemented in these nodes separately if lateral was an option of SelectStatement. When building the query, an alias can be given as an argument. This enables building a lateral query with an table alias without using either Nodes::TableAlias or Nodes::Lateral directly.
* | Remove Unused `require`Nikolay Ponomarev2017-12-277-8/+1
| | | | | | | | It looks like they are left from old design
* | Reduce `Reduce`Nikolay Ponomarev2017-12-271-1/+1
| | | | | | | | | | Remove `Arel::Visitors::Reduce` because it almost completely duplicates `Arel::Visitors::Visitor`
* | Introduce NodeExpression as parent of scalar nodesKeenan Brock2017-12-051-0/+1
| | | | | | | | | | 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/+9
| |
* | Type-castable attributes should not try to cast SqlLiteral nodesJames Coleman2017-09-291-0/+12
| |
* | Address `undefined method `value_for_database'` in Oracle visitorYasuo Honda2017-07-251-1/+1
| | | | | | | | | | | | Here `offset` is bound twice. It used to be `:b1` appeared twice. This commit changes the second `offset` name changed from `:b1` to `:b3` which should not affect the actual bind values for offset.
* | Add missing hash, eql?, == to various node classesMaxime Lapointe2017-07-251-0/+34
| | | | | | | | | | | | | | | | | | | | | | 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
* | Remove unused `bind_values`Ryuta Kamizono2017-07-251-7/+0
| | | | | | | | | | Since https://github.com/rails/rails/commit/213796f, `bind_values` is no longer used from Active Record.
* | Fix test failuresSean Griffin2017-07-247-14/+14
| |
* | Add a collector to grab the bind values off the ASTSean Griffin2017-07-212-0/+87
| | | | | | | | | | | | | | | | Now that the bind values are being stored on the actual AST, we need a way to pull them off into the array that we were previously maintaining separately. This requires a full walk of the AST. This is an expensive operation, so I've also added a visitor for delegating to more than one visitor in a single pass.
* | Ensure `ToSql` collector returns a UTF-8 stringSean Griffin2017-07-211-0/+8
| | | | | | | | | | | | | | | | Switching from `''.dup` to `String.new` had the side effect of changing the encoding on Ruby 2.4 and later. Oddly, `String.new(encoding: Encoding::UTF_8)` is significantly slower than `''.dup`. This seems like a bug in Ruby, but not something we're going to address right now. A test has been added to ensure this regression doesn't occur again.
* | Refactor `substitute_binds` to perform substitution immediatelySean Griffin2017-07-211-45/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm honestly not sure if replacing bind params with their concrete values is something that belongs in Arel at all, as it's something that will need to be coupled to the quoting mechanism of the caller, and could just be accomplished by using `Quoted` instead. Still, with the new structure we can provide a much simpler API around substitution. The expectation of the quoter responding to `quote` is a reasonably minimal API. I originally used `DelegateClass` here, with the one line override of `add_bind`, but realized that we have some funky code going on where the collector returns the next collector to use (in practice `self` is always returned, and I don't see why we'd ever want to do this). Removing that would likely be worthwhile, but would be a larger refactoring
* | Add a value field `Nodes::BindParam`Sean Griffin2017-07-2110-82/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Rename `Collectors::Bind`Sean Griffin2017-07-212-3/+2
| | | | | | | | | | | | The "bind collector" does not actually collect bind params at all, it substitutes them out of the final AST, replacing them with a quoted value.
* | Merge pull request #484 from kirs/multiple-insert-v2Rafael França2017-06-151-0/+54
|\ \ | | | | | | Support INSERT with multiple values (v2)
| * | Support INSERT with multiple valuesKir Shatrov2017-05-221-0/+54
| | |
* | | Merge pull request #472 from film42/masterMatthew Draper2017-06-051-0/+49
|\ \ \ | |/ / |/| | Make Visitor visit thread safe by holding dispatch method reference
| * | Test concurrency of visitor superclass fallbackMatthew Draper2017-06-051-0/+49
| | |
* | | Merge pull request #483 from kamipo/remove_unused_engineRafael França2017-05-051-2/+2
|\ \ \ | | | | | | | | Remove unused `engine`
| * | | Remove unused `engine`Ryuta Kamizono2017-05-041-2/+2
| | |/ | |/| | | | | | | | | | | | | Follow up of 98fc25991137ee09b6800578117f8c1c322680f2. `engine` is only used for `to_sql` and `where_sql` now.
* | | Add regression testRafael Mendonça França2017-05-041-0/+11
| | |
* | | Revert "Merge pull request #482 from kirs/multiple-insert"Rafael Mendonça França2017-05-043-22/+3
| | | | | | | | | | | | | | | | | | | | | This reverts commit 6d105c7f891a14316eab47dfff3bf1b94f3204e7, reversing changes made to 437aa3a4bb8ad4f3f4eba299dbb1112852f9c7ac. This broke Active Record when the values are sql literals
* | | Support multiple insertsKir Shatrov2017-05-013-3/+22
|/ /
* | Made InsertManager#insert chainablePedro Sena2017-02-281-0/+7
| |
* | Merge pull request #470 from kmmndr/named_function_eq_nilRafael França2017-02-211-0/+6
|\ \ | |/ |/| named functions compared to nil
| * named functions compared to nilThomas Kienlen2017-02-021-0/+6
| |
* | Enable frozen_string_literal in all files in arelRafael Mendonça França2017-02-1358-0/+58
|/
* Raise custom error on empty joinDaniel Colson2017-01-172-0/+16
|
* Address `Use assert_nil if expecting nil` warningsYasuo Honda2016-12-301-2/+2
|
* Fix identationRafael Mendonça França2016-12-291-7/+7
|
* Remove deprecated type cast support in ArelRafael Mendonça França2016-12-294-93/+5
|
* use #data_source_exists? instead of deprecated #table_exists?Alexander Baronec2016-10-081-1/+1
|
* Merge pull request #443 from mgbatchelor/masterRafael França2016-10-071-0/+12
|\ | | | | remove union mapping as :binary node when performing DepthFirst enumeration
| * remove union mapping as :binary node when performing DepthFirst enumerationMichael Batchelor2016-08-191-0/+12
| |
* | Merge pull request #445 from oliverguenther/fix/dot-visitor-casted-nodeRafael França2016-10-071-0/+1
|\ \ | | | | | | Add Arel::Nodes::Casted to dot visitor
| * | Add Arel::Nodes::Casted to dot visitorOliver Günther2016-08-271-0/+1
| |/ | | | | | | | | | | | | Adds casted node to the dot visitor with outgoing edges to val and attribute. Fixes #419
* | Merge pull request #447 from ojab/masterRafael França2016-10-071-1/+1
|\ \ | | | | | | Freeze all the strings in visitors
| * | Drop unneeded assignmentojab2016-08-311-1/+1
| | |
* | | Fix issue #438 when oracle visitor gets BindParamsRodrigo Castro2016-10-071-1/+15
| | |
* | | Don't store all aliases to a tableSean Griffin2016-09-131-8/+1
|/ / | | | | | | | | | | | | The aliases property of a table is never used other than for equality. However, the aliases that have been created for a table aren't really something that should affect whether a table is considered to be the same table or not. This removal does not appear to have any affect within Active Record or within Arel.
* / Add failing test for Dot visitor and BindParamAdam Lassek2016-08-261-0/+6
|/ | | | | | | | | Since BindParam has no value, treating it like a string causes it to fallback to Object#to_s, leading to output like `#<Arel::Nodes::BindParam:0x007fa43c866108>`. Since angle brackets are significant in Dot labels, this causes `Error: bad label format` when passing the graph into dot.
* Merge pull request #417 from tlkahn/masterRafael França2016-07-191-0/+7
|\ | | | | Fix issue #415 - Should Arel::Nodes::True.new() be 1 in sqlite3?
| * Fix issue #415 - Should Arel::Nodes::True.new() be 1 in sqlite3?Yong Guo2016-03-011-0/+7
| |
* | Merge pull request #422 from yahonda/oracle12_support_bind_valueSean Griffin2016-05-061-2/+13
|\ \ | | | | | | Support Oracle bind parameter value for Oracle12 visitor
| * | Support Oracle bind parameter value for Oracle12 visitorYasuo Honda2016-04-111-2/+13
| |/
* | Merge pull request #432 from tradegecko/pg-grouping-elements-supportRafael França2016-05-051-0/+78
|\ \ | | | | | | PG: Add Support for GroupBy's Cube, Rollup and Grouping Set