aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Merge pull request #23497 from kamipo/extract_schema_qualified_nameJeremy Daer2016-04-191-8/+15
|\ | | | | | | Extract `extract_schema_qualified_name` method
| * Extract `extract_schema_qualified_name` methodRyuta Kamizono2016-02-051-8/+15
| |
* | Merge pull request #23515 from kamipo/extract_arel_visitorJeremy Daer2016-04-191-9/+0
|\ \ | | | | | | | | | Extract `arel_visitor` and move up to the abstract adapter
| * | Extract `arel_visitor` and move up to the abstract adapterRyuta Kamizono2016-04-041-9/+0
| | |
* | | Merge pull request #23522 from kamipo/add_value_too_long_exception_classJeremy Daer2016-04-181-0/+2
|\ \ \ | | | | | | | | | | | | Add `ActiveRecord::ValueTooLong` exception class
| * | | Add `ActiveRecord::ValueTooLong` exception classRyuta Kamizono2016-02-061-0/+2
| | |/ | |/|
* | | Database comments: switch to keyword args for new table optionsJeremy Daer2016-04-181-10/+10
| | | | | | | | | | | | | | | | | | * Switch to keyword args where we can without breaking compat. * Use add_table_options! for :options, too. * Some code polish.
* | | Add support for specifying comments for tables, columns, and indexes.Andrey Novikov2016-04-161-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Comments are specified in migrations, stored in database itself (in its schema), and dumped into db/schema.rb file. This allows to generate good documentation and explain columns and tables' purpose to everyone from new developers to database administrators. For PostgreSQL and MySQL only. SQLite does not support comments at the moment. See docs for PostgreSQL: http://www.postgresql.org/docs/current/static/sql-comment.html See docs for MySQL: http://dev.mysql.com/doc/refman/5.7/en/create-table.html
* | | Merge pull request #24522 from vipulnsward/run-mariadb-on-travisJeremy Daer2016-04-131-4/+4
|\ \ \ | | | | | | | | Test against MariaDB 10.0
| * | | Include running mariadb on travisVipul A M2016-04-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Specify we want to run on latest stable ruby for mariadb - change in runs of builds Make mariadb? method publicly available
* | | | :nodoc: version method.Vipul A M2016-04-131-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | Reason: - Its not publicly used method. - Exposing it makes an assumption that other adapters support it based on its usage - ActiveRecord::Base.connection.version [ci skip]
* | | Support microsecond datetime precision on MariaDB 5.3+.Jeremy Daer2016-04-081-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | We support microsecond datetime precision for MySQL 5.6.4+. MariaDB has supported it since 5.3.0, but even 10.x versions return a compatible version string like `5.5.5-10.1.8-MariaDB-log` which we parse as 5.5.5, before MySQL supported microsecond precision. Specialize our version check to account for MariaDB to fix.
* | | Merge pull request #24078 from kamipo/show_variablesRafael França2016-04-061-2/+1
|\ \ \ | | | | | | | | Simply use `select_value` in `show_variable`