aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| | | * | | | | | | | Type-castable attributes should not try to cast SqlLiteral nodesJames Coleman2017-09-292-1/+13
| | |/ / / / / / / /
| | * | | | | | | | Merge pull request #496 from amatsuda/froms_to_nowhereAkira Matsuda2017-09-241-2/+0
| | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Unused variable
| | | * | | | | | | | Unused variablesAkira Matsuda2017-09-011-2/+0
| | | | | | | | | | |
| | * | | | | | | | | Merge pull request #499 from jgraichen/jg/cte-bindparamsSean Griffin2017-09-211-1/+2
| | |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Support BindParams in subqueries
| | | * | | | | | | | | Support BindParams in subqueriesJan Graichen2017-09-191-1/+2
| | |/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an Arel AST contains a SelectManager as a component, e.g. as a CTE expression, the SelectManager is converted to SQL with `#to_sql`. This uses a new collector that leads to invalid expressions when using bind parameters. For example, when generating PostgreSQL queries, the bind parameter number starts from one again. When using the SubstituteBinds collector, binds in the subquery are not substituted. This commit changes the ToSql visitor to visit the SelectManager ast itself.
| | * | | | | | | | | Merge pull request #498 from yhirano55/update_travisSean Griffin2017-09-151-3/+3
| | |\ \ \ \ \ \ \ \ \ | | | |/ / / / / / / / | | |/| | | | | | | | Update .travis.yml
| | | * | | | | | | | Update .travis.ymlYoshiyuki Hirano2017-09-151-3/+3
| | |/ / / / / / / /
| | * | | | | | | | Merge pull request #495 from koic/add_required_ruby_version_to_gemspecRafael França2017-08-143-10/+7
| | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Add required_ruby_version to gemspec
| | | * | | | | | | | Update travis.ymlKoichi ITO2017-08-141-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | travis.yml made it follow Rails (AR). The summary is as follows. - Drop MRI 2.2.1 or lower and updated with latest MRI versions - Drop rbx-2. This build has failed since before - Update JRuby version to 9.1.12.0
| | | * | | | | | | | Add required_ruby_version to gemspecKoichi ITO2017-08-142-0/+2
| | |/ / / / / / / /
| | * | | | | | | | Merge pull request #494 from koic/remove_encoding_utf8_magic_commentMatthew Draper2017-08-103-3/+0
| | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Remove encoding utf-8 magic comment
| | | * | | | | | | | Remove encoding utf-8 magic commentKoichi ITO2017-08-093-3/+0
| | |/ / / / / / / /
| | * | | | | | | | Merge pull request #493 from gaurish/patch-1Sean Griffin2017-07-291-1/+0
| | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Remove Unused variable - offset_bind
| | | * | | | | | | | Remove Unused variable - offset_bindGaurish Sharma2017-07-291-1/+0
| | |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes warning in Rails tests: ``` /home/travis/build/rails/rails/vendor/bundle/ruby/2.4.0/bundler/gems/arel-b9ca36f09d5e/lib/arel/visitors/oracle.rb:32: warning: assigned but unused variable - offset_bind ``
| | * | | | | | | | Merge pull request #492 from mikaji/ci_against_2.4.1Sean Griffin2017-07-271-1/+1
| | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | CI against ruby 2.4.1
| | | * | | | | | | | CI against 2.4.1Koji Mikami2017-07-271-1/+1
| | | | | | | | | | |
| | * | | | | | | | | Merge pull request #491 from yahonda/follow_up_add_bind_for_oracle_visitorSean Griffin2017-07-272-4/+5
| | |\ \ \ \ \ \ \ \ \ | | | |/ / / / / / / / | | |/| | | | | | | | Oracle visitor needs two more `add_bind` argument fix
| | | * | | | | | | | Address `undefined method `value_for_database'` in Oracle visitorYasuo Honda2017-07-252-4/+5
| | |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | | | Change the verison to 9.0.0.alphaSean Griffin2017-07-252-2/+2
| | | | | | | | | |
| | * | | | | | | | Merge pull request #490 from MaxLap/fix_nodes_hash_eql_eqeqSean Griffin2017-07-258-1/+56
| | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Add missing hash, eql?, == to various node classes
| | | * | | | | | | | Add missing hash, eql?, == to various node classesMaxime Lapointe2017-07-258-1/+56
| | |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * | | | | | | | Merge pull request #489 from kamipo/remove_unused_bind_valuesSean Griffin2017-07-252-11/+1
| | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Remove unused `bind_values`
| | | * | | | | | | | Remove unused `bind_values`Ryuta Kamizono2017-07-252-11/+1
| | |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | | | | | | | | |
| | * | | | | | | | 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 collector to grab the bind values off the ASTSean Griffin2017-07-214-0/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-212-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-216-68/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2114-125/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-215-15/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-155-0/+94
| | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Support INSERT with multiple values (v2)
| | | * | | | | | | | Support INSERT with multiple valuesKir Shatrov2017-05-225-0/+94
| | | | | | | | | | |
| | * | | | | | | | | Merge pull request #472 from film42/masterMatthew Draper2017-06-055-4/+57
| | |\ \ \ \ \ \ \ \ \ | | | |/ / / / / / / / | | |/| | | | | | | | Make Visitor visit thread safe by holding dispatch method reference
| | | * | | | | | | | Test concurrency of visitor superclass fallbackMatthew Draper2017-06-053-0/+51
| | | | | | | | | | |
| | | * | | | | | | | Make Visitor visit thread safe by holding dispatch method referenceGarrett Thornburg2017-02-172-4/+6
| | | | | | | | | | |
| | * | | | | | | | | Merge pull request #483 from kamipo/remove_unused_engineRafael França2017-05-052-3/+3
| | |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Remove unused `engine`
| | | * | | | | | | | | Remove unused `engine`Ryuta Kamizono2017-05-042-3/+3
| | | | |/ / / / / / / | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-047-54/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6d105c7f891a14316eab47dfff3bf1b94f3204e7, reversing changes made to 437aa3a4bb8ad4f3f4eba299dbb1112852f9c7ac. This broke Active Record when the values are sql literals
| | * | | | | | | | | Merge pull request #482 from kirs/multiple-insertRafael França2017-05-047-5/+54
| | |\ \ \ \ \ \ \ \ \ | | | |/ / / / / / / / | | |/| | | | | | | | Support multiple inserts
| | | * | | | | | | | Support multiple insertsKir Shatrov2017-05-017-5/+54
| | |/ / / / / / / /
| | * | | | | | | | Merge pull request #475 from PedroSena/chainable-insertRafael França2017-02-282-0/+8
| | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Made InsertManager#insert chainable
| | | * | | | | | | | Made InsertManager#insert chainablePedro Sena2017-02-282-0/+8
| | |/ / / / / / / /
| | * | | | | | | | Merge pull request #474 from JaKXz/patch-1Rafael França2017-02-221-1/+8
| | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | docs: add distinct example to README
| | | * | | | | | | | docs(distinct): tweaks [skip ci]Jason Kurian2017-02-221-1/+1
| | | | | | | | | | |
| | | * | | | | | | | docs(distinct): fix distinct example [skip ci]Jason Kurian2017-02-221-2/+2
| | | | | | | | | | |
| | | * | | | | | | | docs: add distinct to READMEJason Kurian2017-02-221-1/+8
| | |/ / / / / / / /
| | * | | | | | | | Prepare to 8.0.0Rafael Mendonça França2017-02-212-1/+4
| | | | | | | | | |
| | * | | | | | | | 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
| | | | | | | | | |