diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2017-07-24 08:19:35 -0400 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2017-07-24 09:07:24 -0400 |
commit | 213796fb4936dce1da2f0c097a054e1af5c25c2c (patch) | |
tree | 9178558ae4108ce96b9b41bd98f000684aac034b /RAILS_VERSION | |
parent | 0449d8b6bc02f4c0a416a7c40550e3b8b988d113 (diff) | |
download | rails-213796fb4936dce1da2f0c097a054e1af5c25c2c.tar.gz rails-213796fb4936dce1da2f0c097a054e1af5c25c2c.tar.bz2 rails-213796fb4936dce1da2f0c097a054e1af5c25c2c.zip |
Refactor Active Record to let Arel manage bind params
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.
Diffstat (limited to 'RAILS_VERSION')
0 files changed, 0 insertions, 0 deletions