aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* | Fix that `change_column` lose a commentRyuta Kamizono2016-12-051-0/+4
| |
* | Fix that unsigned with zerofill is treated as signedRyuta Kamizono2016-11-271-1/+1
| | | | | | | | Fixes #27125.
* | Refactor column initialization into `new_column_from_field`Kir Shatrov2016-11-111-11/+7
| | | | | | | | that accepts results of SHOW FIELDS
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
| |
* | Permit loads while queries are runningMatthew Draper2016-10-271-1/+5
| | | | | | | | | | 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-271-2/+2
|\ \ | | | | | | Use Regexp#match? rather than Regexp#===
| * | Use Regexp#match? rather than Regexp#===Ryuta Kamizono2016-10-261-2/+2
| | | | | | | | | | | | 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.
* | 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
* | Dump index options to pretty formatRyuta Kamizono2016-10-101-2/+2
| | | | | | | | | | | | | | | | | | | | ```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-1/+1
|/ | | | | Currently blank comment does not dump to `db/schema.rb`. But created it even if specified blank.
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-2/+2
| | | | | | 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.
* Fix Remaining Case-In-Assignment Statement FormattingAlex Kitchens2016-09-061-16/+17
| | | | | | | | | 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.
* Revert "Extract `PredicateBuilder::CaseSensitiveHandler`"Sean Griffin2016-08-311-3/+4
| | | | | | | | | 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.
* Remove text default treated as an empty string in non-strict modeRyuta Kamizono2016-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #25396 from ↵Rafael França2016-08-171-1/+1
|\ | | | | | | | | kamipo/fix_error_message_for_out_of_range_integer_value Fix error message for out of range byte size integer value for consistency
| * Fix error message for out of range byte size integer value for consistencyRyuta Kamizono2016-08-071-1/+1
| | | | | | | | Related f27a932, #25391.
* | Extract `PredicateBuilder::CaseSensitiveHandler`Ryuta Kamizono2016-08-161-4/+3
| | | | | | | | | | | | Currently uniqueness validator is coupled with building Arel ASTs. This commit extracts `PredicateBuilder::CaseSensitiveHandler` for decouple the building Arel ASTs.
* | Merge pull request #26155 from kamipo/refactor_quoted_columns_for_indexRafael Mendonça França2016-08-161-16/+9
|\ \ | | | | | | | | | Refactor `quoted_columns_for_index` by extracted `add_options_for_index_columns`
| * | Refactor `quoted_columns_for_index` by extracted `add_options_for_index_columns`Ryuta Kamizono2016-08-141-16/+9
| |/
* / Add three new rubocop rulesRafael Mendonça França2016-08-161-7/+7
|/ | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Merge pull request #26073 from kamipo/revert_passing_splat_binds_for_arel_nodeSean Griffin2016-08-061-1/+1
|\ | | | | Revert passing arel node with splat binds for `where`
| * Don't passing a nil value to `case_sensitive_comparison`Ryuta Kamizono2016-08-061-1/+1
| | | | | | | | | | A `value` is only used for checking `value.nil?`. It is unnecessary if immediately return when `value.nil?`.
* | applies remaining conventions across the projectXavier Noria2016-08-061-13/+13
| |
* | normalizes indentation and whitespace across the projectXavier Noria2016-08-061-268/+268
| |
* | modernizes hash syntax in activerecordXavier Noria2016-08-061-2/+2
| |
* | applies new string literal convention in activerecord/libXavier Noria2016-08-061-77/+77
|/ | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* The problem isn't the detection but the deadlock itselfDavid Heinemeier Hansson2016-08-041-1/+1
|
* Merge pull request #25107 from Erol/introduce-new-ar-transaction-error-classesRafael Mendonça França2016-08-031-1/+1
|\ | | | | | | | | | | Introduce new ActiveRecord transaction error classes Closes #26018
| * Introduce new ActiveRecord transaction error classesErol Fornoles2016-05-241-1/+1
| |
* | Merge pull request #25340 from kamipo/prevent_table_comment_queryRafael França2016-07-281-3/+9
|\ \ | | | | | | 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-101-3/+9
| | |
* | | 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.
* | | 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]
* | | adds missing requiresXavier Noria2016-07-241-0/+1
| | |
* | | systematic revision of =~ usage in ARXavier Noria2016-07-231-1/+1
| | | | | | | | | | | | | | | Where appropriatei, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
* | | 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.
* | | Extract foreign key action from `information_schema`Ryuta Kamizono2016-06-071-15/+15
| | | | | | | | | | | | Fixes #25300.
* | | Make `foreign_keys` queries to `SCHEMA`Ryuta Kamizono2016-06-071-1/+1
|/ /
* / Do not include default column limit in schema.rbRyuta Kamizono2016-05-311-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up of #20815. ```ruby class CreatePeople < ActiveRecord::Migration[5.0] def change create_table :people do |t| t.integer :int t.bigint :bint t.text :txt t.binary :bin end end end ``` Result. In postgresql and sqlite3 adapters: ```ruby ActiveRecord::Schema.define(version: 20160531141018) do create_table "people", force: :cascade do |t| t.integer "int" t.bigint "bint" t.text "txt" t.binary "bin" end end ``` In mysql2 adapter: ```ruby ActiveRecord::Schema.define(version: 20160531141018) do create_table "people", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| t.integer "int" t.bigint "bint" t.text "txt", limit: 65535 t.binary "bin", limit: 65535 end end ``` After this patch: ```ruby ActiveRecord::Schema.define(version: 20160531141018) do create_table "people", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| t.integer "int" t.bigint "bint" t.text "txt" t.binary "bin" end end ```
* Add AR::TransactionSerializationError for transaction serialization failures ↵Erol Fornoles2016-05-211-3/+11
| | | | or deadlocks
* Support for unified Integer class in Ruby 2.4+Jeremy Daer2016-05-181-2/+2
| | | | | | | | Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005 * Forward compat with new unified Integer class in Ruby 2.4+. * Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3. * Drops needless Fixnum distinction in docs, preferring Integer.
* Should quote `lock_name` to pass to `get_advisory_lock`Ryuta Kamizono2016-05-101-2/+2
|
* Add `:nodoc:` to `schema_creation` [ci skip]Ryuta Kamizono2016-05-021-1/+1
| | | | | | | `schema_creation` is not public API. https://github.com/rails/rails/blob/v5.0.0.beta4/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L121 https://github.com/rails/rails/blob/v5.0.0.beta4/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L78
* Extract `add_sql_comment!` methodRyuta Kamizono2016-04-291-1/+5
| | | | | | Refactor of #22911. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Follow up of #23461Vipul A M2016-04-241-1/+1
| | | | | | | | - Rename max to statement_limit - Remove magic number 1000 from everywhere - Defined StatementPool::DEFAULT_STATEMENT_LIMIT and started using it everywhere Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Include the Savepoints module in all adapters.Vipul A M2016-04-241-1/+0
| | | | | Adapters override `#supports_savepoints?` to return `true` if they support transaction savepoints. Defaults to `false`.
* Merge pull request #23461 from kamipo/prepared_statements_for_mysql2_adapterJeremy Daer2016-04-231-5/+23
|\ | | | | | | Add prepared statements support for `Mysql2Adapter`
| * Add prepared statements support for `Mysql2Adapter`Ryuta Kamizono2016-04-211-5/+25
|/
* Define `arel_visitor` method on all adaptersRyuta Kamizono2016-04-201-0/+4
| | | | `Arel::Visitors::VISITORS` was removed at https://github.com/rails/arel/pull/412.