aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract
Commit message (Collapse)AuthorAgeFilesLines
* Fix pool_from_any_process to use most recent speceileencodes2017-01-131-1/+1
| | | | | | | | | | | | | If a process is forked more than once, the pool was grabbing the oldest spec, not the most recent spec. This wasn't noticed before because most folks are lilely forking the process only once. If you're forking the process multiple times however the wrong spec name will be returned and an incorrect connection will be used for the process. This fixes the issue by reversing the list of spec names so we can grab the most recent spec rather than the oldest spec.
* class Foo < Struct.new(:x) creates an extra unneeded anonymous classAkira Matsuda2017-01-131-10/+6
| | | | because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it
* Merge pull request #25522 from ↵Rafael França2017-01-031-6/+4
|\ | | | | | | | | kamipo/fix_select_rows_method_signature_for_consistency Fix `select_rows` method signature for consistency
| * Fix `select_rows` method signature for consistencyRyuta Kamizono2017-01-041-6/+4
| | | | | | | | | | | | | | | | Related #22973, #24708. `select_all`, `select_one`, `select_value`, and `select_values` method signature is `(arel, name = nil, binds = [])`. But `select_rows` is `(sql, name = nil, binds = [])`.
* | Deprecate passing `name` to `indexes` like `tables`Ryuta Kamizono2017-01-041-1/+3
|/ | | | | Passing `name` to `tables` is already deprecated at #21601. Passing `name` to `indexes` is also unused.
* Merge pull request #27441 from koic/quoted_insert_version_sqlKasper Timm Hansen2016-12-311-4/+4
|\ | | | | Add a quote to an SQL insert statement of schema migration
| * Add a quote to an SQL insert statement of schema migrationKoichi ITO2016-12-231-4/+4
| |
* | Remove deprecated `#insert_sql`, `#update_sql`, and `#delete_sql`Ryuta Kamizono2016-12-301-6/+0
| |
* | Remove deprecated support to query using commas on LIMITRafael Mendonça França2016-12-291-6/+1
| |
* | Remove deprecated `name` argument from `#tables`Rafael Mendonça França2016-12-291-1/+1
| |
* | Remove deprecated support to passing a column to #quoteRafael Mendonça França2016-12-291-11/+1
| |
* | Fix Rubocop violations and fix documentation visibilityRafael Mendonça França2016-12-282-12/+12
| | | | | | | | | | | | Some methods were added to public API in 5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of the public API.
* | Privatize unneededly protected methods in Active RecordAkira Matsuda2016-12-242-15/+14
| |
* | No need to nodoc private methodsAkira Matsuda2016-12-241-3/+3
| |
* | Describe what we are protectingAkira Matsuda2016-12-231-0/+2
|/
* fix QueryCache nil dupRichard Monette2016-12-151-2/+2
| | | | | | | | | | | | | | make sql statements frozen dup if arel is not our string expect runtime error dont wrap runtime error in invalid log errors will now be treated as runtime errors update changelog
* Merge pull request #26687 from kamipo/fix_add_index_to_normalize_optionsMatthew Draper2016-12-061-0/+1
|\ | | | | Fix `add_index` to normalize column names and options
| * Fix `add_index` to normalize column names and optionsRyuta Kamizono2016-10-031-1/+2
| | | | | | | | | | | | | | | | | | | | Currently does not work the following code. ```ruby add_index(:people, ["last_name", "first_name"], order: { last_name: :desc, first_name: :asc }) ``` Normalize column names and options to fix the issue.
* | Change MySQL and Postgresql to use Bigint primary keysJon McCartie2016-12-052-2/+2
| |
* | Don't try to run multiple insert queries at onceSean Griffin2016-12-051-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | SQLite's default query interface ignores anything after the first semicolon in a query. This is actually quite common behavior in database drivers, especially when dealing with code paths for prepared statements (which we are). While this should only affect SQLite, as I'm not aware of any drivers which don't support multi-insert. Even if this does affect other third party drivers though, I'd prefer not to assume that more than one query can be executed per call to `execute`. Fixes #26948. Close #27242.
* | Clear available connections immediatelyMatthew Draper2016-11-271-0/+2
| | | | | | | | | | | | | | | | | | | | It'll be re-cleared when it's rebuilt in with_new_connections_blocked's ensure, but we still need to clear it inside this synchronize -- we've disconnected connections that may be available in the queue, and while other threads are not allowed to make *new* connections, they are still allowed to take existing ones from there. This was incorrectly removed in d314646c965b045724e6bdb9d61dcecfabc0ba8f.
* | Distribute connections to previously blocked threads when we're doneMatthew Draper2016-11-251-19/+17
| | | | | | | | | | | | Two methods block new connections; we were already doing the right thing for clear_reloadable_connections, but it's better placed in with_new_connections_blocked, where it can work for disconnect too.
* | Merge pull request #27057 from kamipo/fix_race_conditionMatthew Draper2016-11-191-6/+7
|\ \ | | | | | | | | | Fix the race condition caused by `with_new_connections_blocked`
| * | Fix the race condition caused by `with_new_connections_blocked`Ryuta Kamizono2016-11-181-8/+4
|/ / | | | | | | | | | | `with_new_connections_blocked` was introduced at #14938. But the method sometimes causes `@new_cons_enabled = false` then never toggled to true.
* | Merge pull request #26905 from bogdanvlviv/docsAndrew White2016-11-133-8/+8
|\ \ | | | | | | Add missing `+` around a some literals.
| * | Add missing `+` around a some literals.bogdanvlviv2016-10-273-8/+8
| | | | | | | | | | | | | | | | | | Mainly around `nil` [ci skip]
* | | Merge pull request #26978 from matthewd/query-cache-poolMatthew Draper2016-11-102-0/+28
|\ \ \ | | | | | | | | Configure query caching (per thread) on the connection pool
| * | | Configure query caching (per thread) on the connection poolMatthew Draper2016-11-062-0/+28
| | | |
* | | | Add ActiveRecord::Base.connection_pool.statPavel2016-11-091-0/+18
|/ / /
* | | Merge pull request #26909 from matthewd/query-cache-connectionMatthew Draper2016-11-061-0/+2
|\ \ \ | | | | | | | | Clear query cache during checkin, instead of an execution callback
| * | | Clear query cache during checkin, instead of an execution callbackMatthew Draper2016-10-271-0/+2
| |/ / | | | | | | | | | | | | | | | | | | It doesn't make sense for the query cache to persist while a connection moves through the pool and is assigned to a new thread. [Samuel Cochran & Matthew Draper]
* | | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-293-3/+3
| | |
* | | Merge pull request #26688 from kamipo/remove_respond_to_indexesKasper Timm Hansen2016-10-281-4/+0
|\ \ \ | | | | | | | | Remove unnecessary `respond_to?(:indexes)` checking
| * | | Remove unnecessary `respond_to?(:indexes)` checkingRyuta Kamizono2016-10-031-4/+0
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | Currently all adapters (postgresql, mysql2, sqlite3, oracle-enhanced, and sqlserver) implemented `indexes` and schema dumper expects implemented `indexes`. https://github.com/rails/rails/blob/v5.0.0/activerecord/lib/active_record/schema_dumper.rb#L208 Therefore `respond_to?(:indexes)` checking is unnecessary.
* | | Use Regexp#match? rather than Regexp#===Ryuta Kamizono2016-10-261-1/+1
| |/ |/| | | | | Follow up to 99cf7558000090668b137085bfe6bcc06c4571dc.
* | Fix indentation of code examplesOrhan Toy2016-10-191-4/+4
| | | | | | | | This commit fixes the generated HTML of the two code examples.
* | Extract `format_colspec` to format column specRyuta Kamizono2016-10-111-3/+1
| |
* | `name` is not a column optionRyuta Kamizono2016-10-102-3/+2
| | | | | | | | `migration_keys` includes `name` but `name` is not a column option.
* | Dump index options to pretty formatRyuta Kamizono2016-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | ```ruby # Before t.index ["firm_id", "type", "rating"], name: "company_index", order: {"rating"=>:desc}, using: :btree # After t.index ["firm_id", "type", "rating"], name: "company_index", order: { rating: :desc }, using: :btree ```
* | Prevent to create blank commentRyuta Kamizono2016-10-081-2/+2
|/ | | | | Currently blank comment does not dump to `db/schema.rb`. But created it even if specified blank.
* Preserve cached queries name in AS notificationsJean Boussier2016-09-221-4/+10
|
* Force correct namespace when using TransactionManagerArthur Neves2016-09-161-1/+1
| | | | [fixes #26441]
* fix typo in `add_column` doc [ci skip]yuuji.yaginuma2016-09-161-1/+1
|
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-142-44/+44
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* fixes remaining RuboCop issues [Vipul A M, Xavier Noria]Xavier Noria2016-09-011-2/+2
|
* Merge pull request #26217 from kamipo/revert_23067Rafael França2016-08-191-1/+1
|\ | | | | Revert "`sql_for_insert` returns values for passing to `exec_insert`"
| * Revert "`sql_for_insert` returns values for passing to `exec_insert`"Ryuta Kamizono2016-08-191-1/+1
| | | | | | | | | | | | | | This reverts #23067. #23067 is for propagating `pk` value from `sql_for_insert` to `exec_insert` (avoiding extra query for pg adapter). Now `exec_insert` includes `sql_for_insert` since #26002 therefore this propagating is no longer needed.
* | Added nil case handling to allow rollback migration in case oftravis.h.oneill@gmail.com2016-08-172-2/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | invalid column type /activerecord/lib/active_record/connection_adapters /abstract/schema_definitions.rb:306 type = type.to_sym Changed to the following to handle nil case: type = type.to_sym if type Added regression test for this case: /activerecord/test/cases/migration_test.rb:554 if current_adapter?(:SQLite3Adapter) def test_allows_sqlite3_rollback_on_invalid_column_type Person.connection.create_table :something, force: true do |t| t.column :number, :integer t.column :name, :string t.column :foo, :bar end assert Person.connection.column_exists?(:something, :foo) assert_nothing_raised { Person.connection.remove_column :something, :foo, :bar } assert !Person.connection.column_exists?(:something, :foo) assert Person.connection.column_exists?(:something, :name) assert Person.connection.column_exists?(:something, :number) ensure Person.connection.drop_table :something, if_exists: true end end
* Merge pull request #26002 from ↵Rafael França2016-08-171-2/+2
|\ | | | | | | | | kamipo/sql_for_insert_should_be_called_inside_exec_insert `sql_for_insert` should be called inside `exec_insert`
| * `sql_for_insert` should be called inside `exec_insert`Ryuta Kamizono2016-08-061-2/+2
| | | | | | | | | | `exec_insert` cannot return last inserted id if `use_insert_returning?` is true. `sql_for_insert` should be called inside `exec_insert`.