aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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`
| * | | Simply use `select_value` in `show_variable`Ryuta Kamizono2016-03-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `SELECT @@name` statement returns only single row or `StatementInvalid`. ``` root@localhost [activerecord_unittest] > SELECT @@version; +-----------+ | @@version | +-----------+ | 5.7.9-log | +-----------+ 1 row in set (0.00 sec) root@localhost [activerecord_unittest] > SELECT @@unknown_variable; ERROR 1193 (HY000): Unknown system variable 'missing_variable' ```
* | | | Merge pull request #24374 from kamipo/move_quoting_methods_to_quoting_moduleRafael França2016-04-061-34/+4
|\ \ \ \ | | | | | | | | | | Move quoting methods to `Quoting` module
| * | | | Make `QUOTED_TRUE` and `QUOTED_FALSE` to public because these are used in ↵Ryuta Kamizono2016-04-061-4/+4
| | | | | | | | | | | | | | | | | | | | `MysqlString`
| * | | | Move `quoted_date`, `quote_string` and `quote_table_name_for_assignment` ↵Ryuta Kamizono2016-04-051-12/+0
| | | | | | | | | | | | | | | | | | | | methods to `Quoting` module
| * | | | Make to private `QUOTED_TRUE` and `QUOTED_FALSE` constantsRyuta Kamizono2016-04-051-18/+0
| | | | |
* | | | | Remove hard-coded backticks in SQL statementsHarsimran Singh Maan2016-04-051-3/+3
|/ / / / | | | | | | | | The hard-coded back-ticks made it hard to use a different char for quoting db fields. This checkin replaces it with quote_table_name.
* | | / Use `QUOTED_TRUE` and `QUOTED_FALSE` instead of magic stringsyui-knk2016-04-051-4/+4
| |_|/ |/| | | | | | | | | | | | | | Because we define `QUOTED_TRUE` as `"1"` and `QUOTED_FALSE` as `"0"`. And add test cases to ensure this commit does not break current behavior even if the value of `attributes_before_type_cast` is false.
* | | Move `@quoted_{column|table}_names` cache up to the abstract adapterRyuta Kamizono2016-03-311-9/+2
| | |
* | | Merge pull request #24368 from kamipo/make_to_private_the_visibilitySean Griffin2016-03-301-8/+2
|\ \ \ | | | | | | | | Make to private the visibility of `_quote` and `_type_cast`
| * | | Make to private the visibility of `_quote` and `_type_cast`Ryuta Kamizono2016-03-301-8/+2
| | | |
* | | | Add a test case for create a record with primary key as zeroRyuta Kamizono2016-03-301-0/+1
|/ / /
* | | Append sql_mode instead of overwriting in strict modeRyuta Kamizono2016-03-131-3/+12
| | | | | | | | | | | | For keep the default SQL mode.
* | | Merge pull request #23797 from ↵Rafael França2016-03-111-3/+3
|\ \ \ | | | | | | | | | | | | | | | | kamipo/case_sensitive_comparison_for_non_string_column The BINARY Operator is only needed for string columns
| * | | The BINARY Operator is only needed for string columnsRyuta Kamizono2016-02-221-3/+3
| |/ / | | | | | | | | | Follow up to #13040.
* | | Passing `table_name` to `Column#initialize` to avoid `instance_variable_set`Ryuta Kamizono2016-03-081-5/+3
| | |
* | | Initialize `column.table_name` immediately for `column.serial?` correctly ↵Ryuta Kamizono2016-03-081-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | working Currently the results of `column.serial?` is not correct. For `column.serial?` correctly working, initialize `column.table_name` immediately.
* | | No need to extract a limit for a boolean typeRyuta Kamizono2016-03-041-1/+1
|/ /
* / Remove needless `case_insensitive_comparison` in mysql2 adapterRyuta Kamizono2016-02-171-6/+3
|/ | | | Simply it is sufficient to override `can_perform_case_insensitive_comparison_for?`.
* Active Record supports MySQL >= 5.0Ryuta Kamizono2016-02-041-10/+7
| | | | | Currently some features uses `information_schema` (e.g. foreign key support). `information_schema` introduced since MySQL 5.0.
* Avoid extra `show variables` in migrationRyuta Kamizono2016-02-011-7/+5
| | | | | | | | | | | | | `initialize_schema_migrations_table` is called in every migrations. https://github.com/rails/rails/blob/v5.0.0.beta1/activerecord/lib/active_record/migration.rb#L1080 https://github.com/rails/rails/blob/v5.0.0.beta1/activerecord/lib/active_record/schema.rb#L51 This means that extra `show variables` is called regardless of the existence of `schema_migrations` table. This change is to avoid extra `show variables` if `schema_migrations` table exists.
* Extract `ExplainPrettyPrinter` to appropriate filesRyuta Kamizono2016-02-011-66/+2
|
* Remove unused `LOST_CONNECTION_ERROR_MESSAGES`Ryuta Kamizono2016-01-311-6/+0
| | | | | `LOST_CONNECTION_ERROR_MESSAGES` was added by f384582. But currently unused from anywhere.
* Remove `limit: 11` as backward-compatibility with Rails 2.0Ryuta Kamizono2016-01-271-1/+0
| | | | | | | Integer limit as a byte size was introduced from Rails 2.1. `limit: 11` is not a byte size, but take care for backward-compatibility with Rails 2.0 (a892af6). Integer limit out of range should be allowed to raise by #6349. I think we should remove this backward-compatibility.