Permalink
Commits on Jul 27, 2017
  1. Merge pull request #492 from mikaji/ci_against_2.4.1

    sgrif committed Jul 27, 2017
    CI against ruby 2.4.1
  2. Merge pull request #491 from yahonda/follow_up_add_bind_for_oracle_vi…

    sgrif committed Jul 27, 2017
    …sitor
    
    Oracle visitor needs two more `add_bind` argument fix
  3. CI against 2.4.1

    mikaji committed Jul 27, 2017
Commits on Jul 25, 2017
  1. Address `undefined method `value_for_database'` in Oracle visitor

    yahonda committed Jul 25, 2017
    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.
  2. Merge pull request #490 from MaxLap/fix_nodes_hash_eql_eqeq

    sgrif committed Jul 25, 2017
    Add missing hash, eql?, == to various node classes
  3. Add missing hash, eql?, == to various node classes

    MaxLap committed Jul 25, 2017
    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
  4. Merge pull request #489 from kamipo/remove_unused_bind_values

    sgrif committed Jul 25, 2017
    Remove unused `bind_values`
  5. Remove unused `bind_values`

    kamipo committed Jul 25, 2017
    Since rails/rails@213796f, `bind_values` is no
    longer used from Active Record.
Commits on Jul 24, 2017
  1. Fix test failures

    sgrif committed Jul 24, 2017
  2. Adjust `BindParam` as needed for AR

    sgrif committed Jul 24, 2017
    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
Commits on Jul 21, 2017
  1. Add a collector to grab the bind values off the AST

    sgrif committed Jul 21, 2017
    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.
  2. Ensure `ToSql` collector returns a UTF-8 string

    sgrif committed Jul 21, 2017
    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.
  3. Refactor `substitute_binds` to perform substitution immediately

    sgrif committed Jul 21, 2017
    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
  4. Add a value field `Nodes::BindParam`

    sgrif committed Jul 21, 2017
    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.
  5. Rename `Collectors::Bind`

    sgrif committed Jul 21, 2017
    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.
Commits on Jun 15, 2017
  1. Merge pull request #484 from kirs/multiple-insert-v2

    rafaelfranca committed Jun 15, 2017
    Support INSERT with multiple values (v2)
Commits on Jun 4, 2017
  1. Merge pull request #472 from film42/master

    matthewd committed Jun 4, 2017
    Make Visitor visit thread safe by holding dispatch method reference
Commits on May 22, 2017
Commits on May 5, 2017
  1. Merge pull request #483 from kamipo/remove_unused_engine

    rafaelfranca committed May 5, 2017
    Remove unused `engine`
Commits on May 4, 2017
  1. Add regression test

    rafaelfranca committed May 4, 2017
  2. Revert "Merge pull request #482 from kirs/multiple-insert"

    rafaelfranca committed May 4, 2017
    This reverts commit 6d105c7, reversing
    changes made to 437aa3a.
    
    This broke Active Record when the values are sql literals
  3. Merge pull request #482 from kirs/multiple-insert

    rafaelfranca committed May 4, 2017
    Support multiple inserts
  4. Remove unused `engine`

    kamipo committed May 4, 2017
    Follow up of 98fc259.
    
    `engine` is only used for `to_sql` and `where_sql` now.
Commits on May 1, 2017
  1. Support multiple inserts

    kirs committed May 1, 2017
Commits on Apr 25, 2017
  1. PostgreSQL lateral expressions

    lautis committed Apr 25, 2017
    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.
  2. Fix link to SQL-92 grammar

    lautis committed Apr 25, 2017
Commits on Feb 28, 2017
  1. Merge pull request #475 from PedroSena/chainable-insert

    rafaelfranca committed Feb 28, 2017
    Made InsertManager#insert chainable
Commits on Feb 22, 2017
  1. Merge pull request #474 from JaKXz/patch-1

    rafaelfranca committed Feb 22, 2017
    docs: add distinct example to README
  2. docs: add distinct to README

    JaKXz committed Feb 22, 2017
Commits on Feb 21, 2017
  1. Prepare to 8.0.0

    rafaelfranca committed Feb 21, 2017