aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #26905 from bogdanvlviv/docsAndrew White2016-11-134-9/+9
|\ | | | | Add missing `+` around a some literals.
| * Add missing `+` around a some literals.bogdanvlviv2016-10-274-9/+9
| | | | | | | | | | | | Mainly around `nil` [ci skip]
* | Add `:nodoc` to `table_structure`Ryuta Kamizono2016-11-121-9/+2
| | | | | | | | | | | | | | | | Follow up to #27008. `table_structure` is an internal method so it is better to hide it in the doc. And alias `table_structure` to `column_definitions` to remove the duplicated `columns` method in the sqlite3 adapter.
* | Refactor column initialization into `new_column_from_field`Kir Shatrov2016-11-114-38/+48
| | | | | | | | that accepts results of SHOW FIELDS
* | 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
| | |
* | | Mysql2::Client::FOUND_ROWS should be defined in all currently supported ↵Akira Matsuda2016-11-101-6/+4
| | | | | | | | | | | | versions of mysql2
* | | Add ActiveRecord::Base.connection_pool.statPavel2016-11-091-0/+18
|/ /
* | Merge pull request #26909 from matthewd/query-cache-connectionMatthew Draper2016-11-062-3/+5
|\ \ | | | | | | Clear query cache during checkin, instead of an execution callback
| * | Clear query cache during checkin, instead of an execution callbackMatthew Draper2016-10-272-3/+5
| |/ | | | | | | | | | | | | 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-2910-17/+17
| |
* | Fix the variable scoping issue I introduced in ↵Matthew Draper2016-10-281-2/+2
| | | | | | | | 007e50d8e5a900547471b6c4ec79d9d217682c5d
* | 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.
* | | Permit loads while queries are runningMatthew Draper2016-10-275-25/+47
| | | | | | | | | | | | | | | A query may wait on a database-level lock, which could lead to a deadlock between threads.
* | | Merge pull request #26899 from kamipo/use_regex_matchXavier Noria2016-10-277-10/+10
|\ \ \ | | | | | | | | Use Regexp#match? rather than Regexp#===
| * | | Use Regexp#match? rather than Regexp#===Ryuta Kamizono2016-10-267-10/+10
| | |/ | |/| | | | | | | Follow up to 99cf7558000090668b137085bfe6bcc06c4571dc.
* / | let Regexp#match? be globally availableXavier Noria2016-10-271-1/+0
|/ / | | | | | | | | | | Regexp#match? should be considered to be part of the Ruby core library. We are emulating it for < 2.4, but not having to require the extension is part of the illusion of the emulation.
* | Fix indentation of code examplesOrhan Toy2016-10-191-4/+4
| | | | | | | | This commit fixes the generated HTML of the two code examples.
* | Merge pull request #26784 from kamipo/quote_table_name_properlyRafael França2016-10-143-13/+15
|\ \ | | | | | | Quote table name properly
| * | Quote table name properlyRyuta Kamizono2016-10-143-13/+15
| | | | | | | | | | | | If does not quote table name properly, invalid SQL is generated.
* | | Support index.length for MySQL 8.0.0-dmrYasuo Honda2016-10-131-1/+1
|/ / | | | | | | | | | | | | MySQL 8.0.0-dmr `SUB_PART` column of `information_schema.statistics` changed to varbinary(12), which is bigint(3) in MySQL 5.6. Addresses #26774
* | Merge pull request #26208 from nanaya/pg-insensitive-textMatthew Draper2016-10-111-2/+6
|\ \ | | | | | | | | | Fix case insensitive check for text column in pg
| * | Fix case insensitive check for text column in pgnanaya2016-09-011-0/+4
| | | | | | | | | | | | There's no 'text to text' casting in the cast table so the feature detection fails.
| * | Use proper castingnanaya2016-09-011-2/+2
| | |
* | | Extract `format_colspec` to format column specRyuta Kamizono2016-10-111-3/+1
| | |
* | | Fix table comment dumpingRyuta Kamizono2016-10-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up to #26735. If `table_options` returns `{ comment: nil }`, `create_table` line is broken. Example: ```ruby create_table "accounts", force: :cascade, do |t| ```
* | | `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-102-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ```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-082-3/+3
| |/ |/| | | | | | | Currently blank comment does not dump to `db/schema.rb`. But created it even if specified blank.
* | Merge pull request #26584 from Shopify/cached-query-nameRafael França2016-09-301-4/+10
|\ \ | | | | | | Preserve cached queries name in AS notifications
| * | Preserve cached queries name in AS notificationsJean Boussier2016-09-221-4/+10
| | |
* | | [ci skip] Update PG adapter documentationAlex Kitchens2016-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Per discussion in pull request #26622: "Let's change it to PG::Error. The more specific classes mentioned are subclasses, and the fact the raised exception is a PG::UndefinedColumn doesn't change the fact that it's also a PG::Error." - matthewd
* | | [ci skip] Clarify Postgresql DocumentationAlex Kitchens2016-09-251-4/+4
|/ / | | | | | | | | This clarifies the object that +ActiveRecord::Base.connection.execute+ will return when using Postgresql.
* | 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-145-96/+96
| | | | | | | | | | | | 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.
* | activerecord/mysql2: Avoid setting @connection to nil, just close itDylan Thacker-Smith2016-09-082-15/+7
| | | | | | | | | | | | | | | | | | | | By doing `@connection = nil` that means that we need nil checks before it is used anywhere, but we weren't doing those checks. Instead, we get a NoMethodError after using a connection after it fails to reconnect. Neither of the other adapters set @connection to nil, just the mysql2 adapter. By just closing it, we avoid the need to check if we have a connection object and it will produce an appropriate exception when used.
* | Fix Remaining Case-In-Assignment Statement FormattingAlex Kitchens2016-09-062-41/+43
| | | | | | | | | | | | | | | | | | Recently, the Rails team made an effort to keep the source code consistent, using Ruboco (bb1ecdcc677bf6e68e0252505509c089619b5b90 and below). Some of the case statements were missed. This changes the case statements' formatting and is consistent with changes in 810dff7c9fa9b2a38eb1560ce0378d760529ee6b and db63406cb007ab3756d2a96d2e0b5d4e777f8231.
* | fixes remaining RuboCop issues [Vipul A M, Xavier Noria]Xavier Noria2016-09-012-4/+4
|/
* Remove deprecated handling of PG PointsSean Griffin2016-08-314-21/+32
| | | | | | | | | | There are some minor changes to the point type as I had forgotten that this will affect the behavior of `t.point` in migrations and the schema dumper so we need to handle those as well. I'll say this again so I can convince myself to come up with a better structure... TYPES SHOULD NOT CARE ABOUT SCHEMA DUMPING AND WE NEED TO BETTER SEPARATE THESE.
* Revert "Extract `PredicateBuilder::CaseSensitiveHandler`"Sean Griffin2016-08-312-9/+10
| | | | | | | | | This reverts commit 3a1f6fe7b4a70bf0698b0684dd48ac712c6883b6. This commit takes the code in a direction that I am looking to avoid. The predicate builder should be purely concerned with AST construction as it matters to methods like `where`. Things like case sensitivity should continue to be handled elsewhere.
* Attempt to maintain encoding for arrays of strings with PGSean Griffin2016-08-311-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | I still think that this is something that should be handled in the pg gem, but it's not going to end up happening there so we'll do it here instead. Once we bump to pg 0.19 we can pass the encoding to the `encode` method instead. This issue occurs because C has no concept of encoding (or strings, really). The bytes that we pass here when sending the value to the database will always be interpreted as whatever encoding the connection is currently configured to use. That means that roundtripping to the database will lose no information However, after assigning we round trip through our type system without hitting the database. The only way that we can do the "correct" thin here would be to actually give a reference to the connection to the array type and have it check the current value of the connection's encoding -- which I'm strongly opposed to. We could also pass in the encoding when it's constructed, but since that can change independently of the type I'm not a huge fan of that either. This feels like a reasonable middle ground, where if we have an array of strings we simply use the encoding of the string we're given. Fixes #26326.
* Add `Type.default_value` and use it everywhere for internalRyuta Kamizono2016-08-261-1/+1
| | | | For reduce instantiating `Type::Value`.
* Fix `OID::Bit#cast_value`Ryuta Kamizono2016-08-201-2/+2
| | | | Fixes #26137.
* Remove unused `blob_or_text_column?` methodRyuta Kamizono2016-08-191-4/+0
|
* Merge pull request #26154 from ↵Rafael Mendonça França2016-08-193-24/+5
|\ | | | | | | | | | | kamipo/remove_text_default_treated_as_empty_string Remove text default treated as an empty string in non-strict mode
| * Remove text default treated as an empty string in non-strict modeRyuta Kamizono2016-08-193-24/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Strict mode controls how MySQL handles invalid or missing values in data-change statements such as INSERT or UPDATE. If strict mode is not in effect, MySQL inserts adjusted values for invalid or missing values and produces warnings. ```ruby def test_mysql_not_null_defaults_non_strict using_strict(false) do with_mysql_not_null_table do |klass| record = klass.new assert_nil record.non_null_integer assert_nil record.non_null_string assert_nil record.non_null_text assert_nil record.non_null_blob record.save! record.reload assert_equal 0, record.non_null_integer assert_equal "", record.non_null_string assert_equal "", record.non_null_text assert_equal "", record.non_null_blob end end end ``` It is inconsistent with other types that only text/blob defaults treated as an empty string. This commit fixes the inconsistency.
* | 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.