aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2016-08-021-1/+1
|\
| * Fix documentation of `index` option for the `add_reference` method [ci skip]Prathamesh Sonpatki2016-07-161-1/+1
| | | | | | | | - Followup of https://github.com/rails/rails/pull/23179.
* | Merge pull request #25937 from kamipo/remove_prepare_binds_for_databaseRafael França2016-07-283-6/+2
|\ \ | | | | | | Remove `prepare_binds_for_database` internal method
| * | Remove `prepare_binds_for_database` internal methodRyuta Kamizono2016-07-283-6/+2
| | | | | | | | | | | | To avoid relying on the connection adapter for type casting binds.
* | | Merge pull request #25340 from kamipo/prevent_table_comment_queryRafael França2016-07-282-3/+13
|\ \ \ | | | | | | | | Prevent `table_comment` query if a table doesn't have a comment
| * | | Prevent `table_comment` query if a table doesn't have a commentRyuta Kamizono2016-06-102-3/+13
| | | |
* | | | Merge pull request #25974 from ↵Rafael França2016-07-281-2/+4
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | kamipo/avoid_calling_current_database_in_table_comment Avoid calling `current_database` in `table_comment`
| * | | | Avoid calling `current_database` in `table_comment`Ryuta Kamizono2016-07-281-2/+4
| | |/ / | |/| | | | | | | | | | | | | | | | | | `current_database` executes a query and `table_comment` is called to all tables even if a table does not have a comment. Using `current_database` increases extra queries.
* / | | `@quoted_{column,table}_names` should cache a frozen stringRyuta Kamizono2016-07-283-5/+5
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Caching a mutable string causes the following issue. ``` Loading development environment (Rails 5.1.0.alpha) irb(main):001:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!' => "`foo`!!" irb(main):002:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!' => "`foo`!!!!" irb(main):003:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!' => "`foo`!!!!!!" ```
* | | Add the TABLE_SCHEMA condition to the SELECT statement in table_comment (#25945)Takeshi AKIMA2016-07-271-1/+2
| | | | | | | | | [Rafael Mendonça França + Takeshi AKIMA]
* | | Merge pull request #25938 from ↵Rafael França2016-07-271-3/+4
|\ \ \ | | | | | | | | | | | | | | | | kamipo/decouple_statement_cache_from_connection_adapter Decouple statement cache from connection adapter
| * | | Decouple statement cache from connection adapterRyuta Kamizono2016-07-241-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | `StatementCache` is hard-coded in `cacheable_query` and be passed `visitor` and `collector` from connection adapter. Simply it is enough to pass a collected value.
* | | | Merge pull request #25408 from kamipo/should_not_reuse_quoted_trueYves Senn2016-07-272-5/+5
|\ \ \ \ | | | | | | | | | | Quoting booleans should return a frozen string
| * | | | Quoting booleans should return a frozen stringRyuta Kamizono2016-07-272-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If reuse `QUOTED_TRUE` and `QUOTED_FALSE` without frozen, causing the following issue. ``` Loading development environment (Rails 5.1.0.alpha) irb(main):001:0> ActiveRecord::Base.connection.quote(true) << ' foo' => "1 foo" irb(main):002:0> ActiveRecord::Base.connection.quote(true) << ' foo' => "1 foo foo" irb(main):003:0> type = ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString.new => #<ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString:0x007fd40c15e018 @precision=nil, @scale=nil, @limit=nil> irb(main):004:0> type.serialize(true) << ' bar' => "1 foo foo bar" irb(main):005:0> type.cast(true) << ' bar' => "1 foo foo bar bar" ```
* | | | | Merge pull request #25523 from kamipo/extract_quoted_binds_type_casted_bindsSean Griffin2016-07-264-6/+10
|\ \ \ \ \ | |/ / / / |/| | | | Extract `type_casted_binds` method
| * | | | Extract `type_casted_binds` methodRyuta Kamizono2016-07-264-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | Because `type_cast` against `binds` always requires `attr.value_for_database` and this pattern appears frequently.
* | | | | adds missing requiresXavier Noria2016-07-241-0/+1
| |/ / / |/| | |
* | | | systematic revision of =~ usage in ARXavier Noria2016-07-233-3/+3
|/ / / | | | | | | | | | | | | Where appropriatei, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
* | | Merge pull request #25578 from ↵Rafael França2016-07-202-8/+11
|\ \ \ | | | | | | | | | | | | | | | | kamipo/move_warning_about_composite_primary_key_to_attribute_methods_primary_key Move the warning about composite primary key to `AttributeMethods::PrimaryKey`
| * | | Move the warning about composite primary key to `AttributeMethods::PrimaryKey`Ryuta Kamizono2016-07-022-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Actually schema dumper/creation supports composite primary key (#21614). Therefore it should not show the warning about composite primary key in connection adapter. This change moves the warning to `AttributeMethods::PrimaryKey` and suppress the warning for habtm join table. Fixes #25388.
* | | | Merge pull request #25889 from kamipo/do_not_dup_binds_in_to_sqlRafael França2016-07-201-1/+1
|\ \ \ \ | | | | | | | | | | Do not `binds.dup` in `connection#to_sql`
| * | | | Do not `binds.dup` in `connection#to_sql`Ryuta Kamizono2016-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | Because `connection#to_sql` does not mutate `binds`.
* | | | | Merge pull request #25828 from bogdanvlviv/ref_default_sequence_nameRafael França2016-07-201-3/+3
|\ \ \ \ \ | | | | | | | | | | | | Refactored method `ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#default_sequence_name`. Refactored test `HasManyAssociationsTest#test_do_not_call_callbacks_for_delete_all`.
| * | | | | Refactored method ↵bogdanvlviv2016-07-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | `ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#default_sequence_name`
* | | | | | Merge pull request #25869 from kamipo/specificiation_id_was_renamed_to_spec_nameRafael França2016-07-201-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | `specificiation_id` was renamed to `spec_name`
| * | | | | | `specificiation_id` was renamed to `spec_name`Ryuta Kamizono2016-07-181-1/+1
| |/ / / / /
* | | | | | Merge pull request #25868 from kamipo/fix_payload_class_name_to_spec_nameRafael França2016-07-201-1/+1
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | Fix `payload[:class_name]` to `payload[:spec_name]`
| * | | | | Fix `payload[:class_name]` to `payload[:spec_name]`Ryuta Kamizono2016-07-171-1/+1
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | Follow up to #20818. `retrieve_connection` is passed `spec_name` instead of `klass` since #24844.
* / / / / Pass `type_casted_binds` to log subscriber for logging bind values properlyRyuta Kamizono2016-07-194-10/+11
|/ / / / | | | | | | | | | | | | Address to https://github.com/rails/rails/commit/5a302bf553af0e6fedfc63299fc5cd6e79599ef3#commitcomment-18288388.
* | | | Merge pull request #20818 from ↵Rafael França2016-07-171-0/+15
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | jeremywadsack/use_transactional_fixtures_all_databases Use notification to ensure that lazy-loaded model classes have transactions
| * | | | Create connection.active_record notification and use that to ensure that lazy-Jeremy Wadsack2016-07-121-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | loaded model classes have their connections wrapped in transactions. See #17776 In Rails 4 config.eager_load was changed to false in the test environment. This means that model classes that connect to alternate databases with establish_connection are not loaded at start up. If use_transactional_fixtures is enabled, transactions are wrapped around the connections that have been established only at the start of the test suite. So model classes loaded later don't have transactions causing data created in the alternate database not to be removed. This change resolves that by creating a new connection.active_record notification that gets fired whenever a connection is established. I then added a subscriber after we set up transactions in the test environment to listen for additional connections and wrap those in transactions as well.
* | | | | Add newline between each migration in `structure.sql`Grey Baker2016-07-141-2/+2
|/ / / / | | | | | | | | | | | | | | | | | | | | Keeps schema migration inserts as a single commit, so we still get all of the benefits of https://github.com/rails/rails/commit/42dd2336b31a8d98776d039a2b9fd7f834156a78, but allows for easier git diff-ing. Fixes #25504.
* | | / rails -> Rails [ci skip]Santosh Wadghule2016-07-121-1/+1
| |_|/ |/| |
* | | [ci skip] Update documentation in AR SchemaStatementsAlex Kitchens2016-07-071-12/+12
| | | | | | | | | | | | This includes minor grammar fixes throughout the file.
* | | Merge pull request #25707 from matthewd/double-reapMatthew Draper2016-07-072-10/+39
|\ \ \ | | | | | | | | Don't reap connections that have already been reassigned
| * | | Make connection stealing more explicitMatthew Draper2016-07-062-5/+23
| | | |
| * | | Reduce locking by taking ownership of stale connectionsMatthew Draper2016-07-061-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | This way, we aren't racing other threads, so we don't need to re-check the conditional. And we no longer need to hold the lock while calling remove (which can choose to make a new connection while we wait).
| * | | Re-check that the connection is still stale before we reap itMatthew Draper2016-07-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A concurrent thread may have also detected it to be stale, and already released (or even reassigned) it by now. Fixes #25585
| * | | Check connection ownership before allowing a thread to release itMatthew Draper2016-07-061-1/+11
| |/ / | | | | | | | | | | | | A thread can only release a connection if it owns it, or it's owned by a thread that has died.
* / / [ci skip] Update ConnectionPool documentation for readabilityAlex Kitchens2016-07-061-21/+21
|/ /
* | Merge pull request #25507 from ↵Rafael França2016-07-021-13/+0
|\ \ | | | | | | | | | | | | bquorning/optimize-for-first-result-and-remove-mysql-select_one Remove #select_one from Mysql2Adapter
| * | Remove MySQL::DatabaseStatements#select_oneBenjamin Quorning2016-06-241-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | The implementation from abstract/database_statements.rb seems to work just fine. And with ActiveRecord::Result now implementing an optimized #first method, the performance concerns previously addressed in https://github.com/rails/rails/commit/bf79aa4fc14aeb2646331e767038acf0b77e9e7f should not be an issue.
* | | Remove `create_table_info_cache` because it not be reusedRyuta Kamizono2016-07-021-6/+1
| | | | | | | | | | | | | | | | | | `create_table_info_cache` is used for sharing `create_table_info` both `table_options` and `foreign_keys`. But `foreign_keys` no longer uses `create_table_info_cache` by #25307. No need caching anymore.
* | | Merge pull request #25307 from ↵Eileen M. Uchitelle2016-07-012-17/+17
|\ \ \ | | | | | | | | | | | | | | | | kamipo/extract_foreign_key_action_from_information_schema Extract foreign key action from `information_schema`
| * | | Extract foreign key action from `information_schema`Ryuta Kamizono2016-06-071-15/+15
| | | | | | | | | | | | | | | | Fixes #25300.
| * | | Make `foreign_keys` queries to `SCHEMA`Ryuta Kamizono2016-06-072-2/+2
| | |/ | |/|
* | | Remove unnecessary `assert_valid_default`Ryuta Kamizono2016-06-251-7/+0
| |/ |/| | | | | | | This was added at c7c3f73 but it never raised because MySQL cannot create text/blob columns with a default value.
* | Merge pull request #25339 from prathamesh-sonpatki/reuse-validate-index-lengthRafael França2016-06-151-7/+7
|\ \ | | | | | | Reuse validate index length
| * | Reuse existing validate_index_length! methodPrathamesh Sonpatki2016-06-091-7/+7
| |/ | | | | | | - Followup of https://github.com/rails/rails/commit/1ea6cc11211dc89e3e14b2b641a3cca8a0a91d55.
* / Fix error message to talk about the scale not precision of the typeRafael Mendonça França2016-06-131-1/+1
|/ | | | Fixes #25391