- 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 提交于
-
- 29 11月, 2013 1 次提交
-
-
由 Ryuta Kamizono 提交于
-
- 05 11月, 2013 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 12 9月, 2013 1 次提交
-
-
由 Rafael Mendonça França 提交于
When the adapter is with prepared statement disabled and the binds array is not empty the connection adapter will try to set the binds values and will fail. Now we are checking if the adapter has the prepared statement disabled. Fixes #12023
-
- 01 9月, 2013 2 次提交
-
-
由 Rafael Mendonça França 提交于
The visitor have to consume the bind parameters to make the statements work when the prepared statement option is disabled. Fixes #12023
- 12 8月, 2013 1 次提交
-
-
由 Vipul A M 提交于
-
- 24 7月, 2013 1 次提交
-
-
由 kennyj 提交于
-