- 21 12月, 2015 1 次提交
-
-
由 Ryuta Kamizono 提交于
Follow up to #22642.
-
- 17 12月, 2015 2 次提交
-
-
由 Rafael Mendonça França 提交于
This reverts commit 4d06ea9a, reversing changes made to e9d15072. Reason: This will break oracle-enhanced, see https://github.com/rsim/oracle-enhanced/blob/3c42131db82b64ac41645db3affc6e4650289df6/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb#L1254
-
由 Ryuta Kamizono 提交于
-
- 21 10月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
Prior to this commit, Rails makes no differentiation between whether a query uses bind parameters, and whether or not we cache that query as a prepared statement. This leads to the cache populating extremely fast in some cases, with the statements never being reused. In particular, the two problematic cases are `where(foo: [1, 2, 3])` and `where("foo = ?", 1)`. In both cases we'll end up quoting the values rather than using a bind param, causing a cache entry for every value ever used in that query. It was noted that we can probably eventually change `where("foo = ?", 1)` to use a bind param, which would resolve that case. Additionally, on PG we can change our generated query to be `WHERE foo = ANY($1)`, and pass an array for the bind param. I hope to accomplish both in the future. For SQLite and MySQL, we still end up preparing the statements anyway, we just don't cache it. The statement will be cleaned up after it is executed. On postgres, we skip the prepare step entirely, as an API is provided to execute with bind params without preparing the statement. I'm not 100% happy on the way this ended up being structured. I was hoping to use a decorator on the visitor, rather than mixing a module into the object, but the way Arel has it's visitor pattern set up makes it very difficult to extend without inheritance. I'd like to remove the duplication from the various places that are extending it, but that'll require a larger restructuring of that initialization logic. I'm going to take another look at the structure of it soon. This changes the signature of one of the adapter's internals, and will require downstream changes from third party adapters. I'm not too worried about this, as worst case they can simply add the parameter and always ignore it, and just keep their previous behavior. Fixes #21992.
-
- 14 10月, 2015 1 次提交
-
-
由 Yves Senn 提交于
The focus of this change is to make the API more accessible. References to method and classes should be linked to make it easy to navigate around. This patch makes exzessiv use of `rdoc-ref:` to provide more readable docs. This makes it possible to document `ActiveRecord::Base#save` even though the method is within a separate module `ActiveRecord::Persistence`. The goal here is to bring the API closer to the actual code that you would write. This commit only deals with Active Record. The other gems will be updated accordingly but in different commits. The pass through Active Record is not completely finished yet. A follow up commit will change the spots I haven't yet had the time to update. /cc @fxn
-
- 10 9月, 2015 1 次提交
-
-
由 amitkumarsuroliya 提交于
Bumps from `5.6` to `5.7`
-
- 13 8月, 2015 1 次提交
-
-
由 Yves Senn 提交于
Closes #21201.
-
- 20 5月, 2015 1 次提交
-
-
由 Ronak Jangir 提交于
-
- 05 5月, 2015 1 次提交
-
-
由 Ryuta Kamizono 提交于
`select_one` create `ActiveRecord::Result` instance. It is better to use `select_rows` instead of `select_one` for performance.
-
- 20 3月, 2015 1 次提交
-
-
由 amitkumarsuroliya 提交于
-
- 03 3月, 2015 2 次提交
-
-
由 Carlos Antonio da Silva 提交于
This reverts commit a38732c8. Since the mutation logic was reverted in 07278519, we must bring the reader method back as well, since the implementation relies on it.
-
由 Aaron Patterson 提交于
-
- 11 2月, 2015 1 次提交
-
-
由 Ryuta Kamizono 提交于
The keys are already validated, so it is better to use the built-in feature to do this.
-
- 02 2月, 2015 1 次提交
-
-
由 Aaron Patterson 提交于
the transaction object shouldn't know so much about active record objects, so let's push the conditionals in to the instance.
-
- 31 1月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
The goal is to remove the type object from the column, and remove columns from the type casting process entirely. The primary motivation for this is clarity. The connection adapter does not have sufficient type information, since the type we want to work with might have been overriden at the class level. By taking this object from the column, it is easy to mistakenly think that the column object which exists on the connection adapter is sufficient. It isn't. A concrete example of this is `serialize`. In 4.2 and earlier, `where` worked in a very inconsistent and confusing manner. If you passed a single value to `where`, it would serialize it before querying, and do the right thing. However, passing it as part of an array, hash, or range would cause it to not work. This is because it would stop using prepared statements, so the type casting would come from arel. Arel would have no choice but to get the column from the connection adapter, which would treat it as any other string column, and query for the wrong value. There are a handful of cases where using the column object to find the cast type is appropriate. These are cases where there is not actually a class involved, such as the migration DSL, or fixtures. For all other cases, the API should be designed as such that the type is provided before we get to the connection adapter. (For an example of this, see the work done to decorate the arel table object with a type caster, or the introduction of `QueryAttribute` to `Relation`). There are times that it is appropriate to use information from the column to change behavior in the connection adapter. These cases are when the primitive used to represent that type before it goes to the database does not sufficiently express what needs to happen. An example of this that affects every adapter is binary vs varchar, where the primitive used for both is a string. In this case it is appropriate to look at the column object to determine which quoting method to use, as this is something schema dependent. An example of something which would not be appropriate is to look at the type and see that it is a datetime, and performing string parsing when given a string instead of a date. This is the type of logic that should live entirely on the type. The value which comes out of the type should be a sufficiently generic primitive that the adapter can be expected to know how to work with it. The one place that is still using the column for type information which should not be necessary is the connection adapter type caster which is sometimes given to the arel table when we can't find the associated table. This will hopefully go away in the near future.
-
- 28 1月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
`bound_attributes` is now used universally across the board, removing the need for the conversion layer. These changes are mostly mechanical, with the exception of the log subscriber. Additional, we had to implement `hash` on the attribute objects, so they could be used as a key for query caching.
-
- 15 1月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
This behavior exists only to support fixtures, so we should handle it there. Leaving it in `#quote` can cause very subtle bugs to slip through, by things appearing to work when they should be blowing up loudly, such as #18385.
-
- 11 1月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
I'm planning on deprecating the column argument to mirror the deprecation in [arel]. [arel]: https://github.com/rails/arel/commit/6160bfbda1d1781c3b08a33ec4955f170e95be11
-
- 01 12月, 2014 1 次提交
-
-
由 Florian Weingarten 提交于
-
- 11 11月, 2014 1 次提交
-
-
由 Andrey Deryabin 提交于
-
- 21 10月, 2014 1 次提交
-
-
由 claudiob 提交于
The `select` method has the same definition in almost all database adapters, so it can be moved from the database-specific adapters (PostgreSQl, MySQL, SQLite) to the abstract `database_statement`: ```ruby def select(sql, name = nil, binds = []) exec_query(sql, name, binds) end ``` --- More details about this commit: the only two DB-specific adapters that have a different definition of `select` are MySQLAdapter and MySQL2Adapter. In MySQLAdapter, `select` invokes `exec_query(sql, name, binds)`, so calling `super` achieves the same goal with less repetition. In MySQL2Adapter, `select` invokes `exec_query(sql, name)`, that is, it does not pass the `binds` parameter like other methods do. However, [MySQL2Adapter's `exec_query`](https://github.com/rails/rails/blob/74a527cc63ef56f3d0a42cf638299958dc7cb08c/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L228L231) works exactly the same whether this parameters is passed or not, so the output does not change: ```ruby def exec_query(sql, name = 'SQL', binds = []) result = execute(sql, name) ActiveRecord::Result.new(result.fields, result.to_a) end ```
-
- 23 9月, 2014 1 次提交
-
-
由 Aaron Patterson 提交于
it doesn't work on SQLite3 since it doesn't support truncate, but that's OK. If you call truncate on the connection, you're now bound to that database (same as if you use hstore or any other db specific feature).
-
- 29 7月, 2014 1 次提交
-
-
由 Arthur Neves 提交于
Add a transaction manager per connection, so it can controls the connection responsibilities. Delegate transaction methods to transaction_manager
-
- 14 6月, 2014 1 次提交
-
-
由 Akshay Vishnoi 提交于
-
- 29 5月, 2014 1 次提交
-
-
由 Arthur Neves 提交于
-
- 15 4月, 2014 1 次提交
-
-
由 Aaron Patterson 提交于
SQL statements for querying associations are now cached
-
- 12 4月, 2014 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 10 4月, 2014 5 次提交
-
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
- 29 3月, 2014 1 次提交
-
-
由 Kelley Reynolds 提交于
-
- 14 3月, 2014 2 次提交
-
-
由 Rafael Mendonça França 提交于
-
由 Arthur Neves 提交于
[fixes #14361] [related #13886]
-
- 31 1月, 2014 1 次提交
-
-
由 Arthur Neves 提交于
This was a common pattern: ``` query = author.posts.select(:title) connection.select_one(query) ``` However `.select` returns a ActiveRecord::AssociationRelation, which has the bind information, so we can use that to get the right sql query. Also fix select_rows on postgress and sqlite3 that were not using the binds [fixes #7538] [fixes #12017] [related #13731] [related #12056]
-
- 18 1月, 2014 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 17 1月, 2014 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 10 1月, 2014 1 次提交
-
-
由 Aaron Patterson 提交于
This reverts commit 026d0555. Conflicts: activerecord/lib/active_record/fixtures.rb Fixes #13383
-
- 03 12月, 2013 1 次提交
-
-
由 Lauro Caetano 提交于
-