1. 22 8月, 2017 3 次提交
  2. 21 8月, 2017 2 次提交
  3. 20 8月, 2017 3 次提交
  4. 18 8月, 2017 2 次提交
  5. 11 8月, 2017 2 次提交
  6. 08 8月, 2017 1 次提交
  7. 07 8月, 2017 1 次提交
    • Y
      Add missed `require` · 3374da7b
      yui-knk 提交于
      `ActiveRecord::ConnectionAdapters::QueryCache::ConnectionPoolConfiguration`
      depends on `Concurrent::Map`.
      3374da7b
  8. 04 8月, 2017 1 次提交
  9. 30 7月, 2017 1 次提交
  10. 28 7月, 2017 1 次提交
  11. 26 7月, 2017 1 次提交
  12. 25 7月, 2017 1 次提交
    • S
      Fix test failures when prepared statements are disabled · 846832ae
      Sean Griffin 提交于
      This also reverts the change to enable prepared statements by default on
      MySQL (though I suspect we could enable them and it'd be great). This
      change brings back a collector closer to the old `Bind` collector in
      Arel. However, this one lives in AR, since this is an AR specific need.
      Additionally, we only use it for statement caching, since the new
      substitute collector in Arel is higher performance for most cases.
      846832ae
  13. 24 7月, 2017 2 次提交
    • S
      Fix build failures on MySQL · 2eaa7be6
      Sean Griffin 提交于
      There's an actual bug in 213796fb around
      prepared statements being disabled. I'm looking into it, but in the mean
      time this gets the build green so it doesn't block other PRs
      2eaa7be6
    • S
      Refactor Active Record to let Arel manage bind params · 213796fb
      Sean Griffin 提交于
      A common source of bugs and code bloat within Active Record has been the
      need for us to maintain the list of bind values separately from the AST
      they're associated with. This makes any sort of AST manipulation
      incredibly difficult, as any time we want to potentially insert or
      remove an AST node, we need to traverse the entire tree to find where
      the associated bind parameters are.
      
      With this change, the bind parameters now live on the AST directly.
      Active Record does not need to know or care about them until the final
      AST traversal for SQL construction. Rather than returning just the SQL,
      the Arel collector will now return both the SQL and the bind parameters.
      At this point the connection adapter will have all the values that it
      had before.
      
      A bit of this code is janky and something I'd like to refactor later. In
      particular, I don't like how we're handling associations in the
      predicate builder, the special casing of `StatementCache::Substitute` in
      `QueryAttribute`, or generally how we're handling bind value replacement
      in the statement cache when prepared statements are disabled.
      
      This also mostly reverts #26378, as it moved all the code into a
      location that I wanted to delete.
      
      /cc @metaskills @yahonda, this change will affect the adapters
      
      Fixes #29766.
      Fixes #29804.
      Fixes #26541.
      Close #28539.
      Close #24769.
      Close #26468.
      Close #26202.
      
      There are probably other issues/PRs that can be closed because of this
      commit, but that's all I could find on the first few pages.
      213796fb
  14. 20 7月, 2017 3 次提交
  15. 19 7月, 2017 2 次提交
    • R
      Fix type casting a time for MariaDB · 8a91fe00
      Ryuta Kamizono 提交于
      Context #24542.
      
      Since 8ebe1f2f, it has lost stripping date part for a time value. But I
      confirmed it is still needed even if MariaDB 10.2.6 GA.
      
      MariaDB 10.2.6, `prepared_statements: true`:
      
      ```
      % ARCONN=mysql2 be ruby -w -Itest test/cases/time_precision_test.rb -n test_formatting_time_according_to_precision
      Using mysql2
      Run options: -n test_formatting_time_according_to_precision --seed 37614
      
      F
      
      Failure:
      TimePrecisionTest#test_formatting_time_according_to_precision [test/cases/time_precision_test.rb:53]:
      Failed assertion, no message given.
      
      bin/rails test test/cases/time_precision_test.rb:46
      
      Finished in 0.040279s, 24.8268 runs/s, 24.8268 assertions/s.
      
      1 runs, 1 assertions, 1 failures, 0 errors, 0 skips
      ```
      8a91fe00
    • S
      Don't convert dates to strings when using prepared statements in mysql · 8ebe1f2f
      Sean Griffin 提交于
      Dates are able to be natively handled by the mysql2 gem. libmysql (and
      the wire protocol) represent each portion of the date as an integer,
      which is significantly faster to encode and decode. By passing the Ruby
      date objects through directly, we can save a good bit of time and
      memory.
      8ebe1f2f
  16. 16 7月, 2017 1 次提交
  17. 14 7月, 2017 1 次提交
    • C
      Catch postgres connection errors when trying to dealloc the statement pool · 325b3cd6
      Chris Williams 提交于
      connection_active? will sometimes return true when the connection is actually dead/disconnected (see #3392 for a discussion of why this is).  When this happens, a query is run on the dead connection which causes various postgres connection errors to be raised.  This fix catches any such errors and ignores them.
      
      Closes #29760
      325b3cd6
  18. 13 7月, 2017 1 次提交
  19. 12 7月, 2017 1 次提交
    • L
      Change sqlite3 boolean serialization to use 1 and 0 · 52e050ed
      Lisa Ugray 提交于
      Abstract boolean serialization has been using 't' and 'f', with MySQL
      overriding that to use 1 and 0.
      
      This has the advantage that SQLite natively recognizes 1 and 0 as true
      and false, but does not natively recognize 't' and 'f'.
      
      This change in serialization requires a migration of stored boolean data
      for SQLite databases, so it's implemented behind a configuration flag
      whose default false value is deprecated. The flag itself can be
      deprecated in a future version of Rails.  While loaded models will give
      the correct result for boolean columns without migrating old data,
      where() clauses will interact incorrectly with old data.
      
      While working in this area, also change the abstract adapter to use
      `"TRUE"` and `"FALSE"` as quoted values and `true` and `false` for
      unquoted.  These are supported by PostreSQL, and MySQL remains
      overriden.
      52e050ed
  20. 11 7月, 2017 1 次提交
  21. 08 7月, 2017 1 次提交
    • P
      Don't allow uuids with orphan curly braces · 38b04171
      pdebelak 提交于
      The uuid validation regex was allowing uuids to have a single leading
      curly brace or single trailing curly brace. Saving with such a uuid
      would cause Postgres to generate an exception even though the record
      seemed valid. With this change, the regex requires both a leading *and*
      a trailing curly brace or neither to be valid.
      38b04171
  22. 07 7月, 2017 4 次提交
  23. 06 7月, 2017 1 次提交
    • D
      Don't translate non-database exceptions. · ad0bde58
      Dennis Taylor 提交于
      The AbstractAdapter will translate all StandardErrors generated during the course of a query into ActiveRecord::StatementInvalids. Unfortunately, it'll also mangle non-database-related errors generated in ActiveSupport::Notification callbacks after the query has successfully completed. This should prevent it from translating errors from ActiveSupport::Notifications.
      ad0bde58
  24. 05 7月, 2017 1 次提交
  25. 02 7月, 2017 2 次提交
    • R
      Fix removed version 5.2 to 6.0 in the deprecation message · 27996bc1
      Ryuta Kamizono 提交于
      Because the deprecation message is not yet released.
      27996bc1
    • E
      Apply record state based on parent transaction state · 0237da28
      eileencodes 提交于
      Let's say you have a nested transaction and both records are saved.
      Before the outer transaction closes, a rollback is performed. Previously
      the record in the outer transaction would get marked as not persisted
      but the inner transaction would get persisted.
      
      ```ruby
      Post.transaction do
        post_one.save # will get rolled back
      
        Post.transaction(requires_new: true) do
          post_two.save # incorrectly remains marked as persisted
        end
      
        raise ActiveRecord::Rollback
      end
      ```
      
      To fix this the PR changes transaction handling to have the child
      transaction ask the parent how the records should be marked. When
      there are child transactions, it will always be a SavpointTransaction
      because the stack isn't empty. From there we pass the parent_transaction
      to the child SavepointTransaction where we add the children to the parent
      so the parent can mark the inner transaction as rolledback and thus mark
      the record as not persisted.
      
      `update_attributes_from_transaction_state` uses the `completed?` check to
      correctly mark all the transactions as rolledback and the inner record as
      not persisted.
      
      ```ruby
      Post.transaction do
        post_one.save # will get rolled back
      
        Post.transaction(requires_new: true) do
          post_two.save # with new behavior, correctly marked as not persisted
          on rollback
        end
      
        raise ActiveRecord::Rollback
      end
      ```
      
      Fixes #29320
      0237da28