aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
Commit message (Collapse)AuthorAgeFilesLines
* Don't query the database schema when calling `serialize`Sean Griffin2014-06-071-8/+11
| | | | | | We need to decorate the types lazily. This is extracted to a separate API, as there are other refactorings that will be able to make use of it, and to allow unit testing the finer points more granularly.
* Refactor quoting of binary data to not be based on the column typeSean Griffin2014-06-031-4/+3
|
* Ensure we always use instances of the adapter specific column classSean Griffin2014-05-281-3/+4
| | | | | | - Create a consistent API across adapters for building new columns - Use it for custom properties so we don't get `UndefinedMethodError`s in stuff I'm implementing elsewhere.
* Remove unnecessary branch from quoting in MysqlSean Griffin2014-05-261-2/+0
| | | | This is already the behavior for `BigDecimal` in the abstract adapter.
* Refactor the type casting of booleans in MySQLSean Griffin2014-05-261-11/+8
|
* Push limit to type objectsSean Griffin2014-05-221-34/+21
| | | | | Columns and injected types no longer have any conditionals based on the format of SQL type strings! Hooray!
* Replace `type_cast` case statement with delegationSean Griffin2014-05-201-2/+1
| | | | | | | | All subclasses of column were now delegating `type_cast` to their injected type object. We can remove the overriding methods, and generalize it on the `Column` class itself. This also enabled us to remove several column classes completely, as they no longer had any meaningful behavior of their own.
* Remove :timestamp column typeSean Griffin2014-05-191-1/+0
| | | | | | | | | | | | The `:timestamp` type for columns is unused. All database adapters treat them as the same database type. All code in `ActiveRecord` which changes its behavior based on the column's type acts the same in both cases. However, when the type is passed to code that checks for the `:datetime` type, but not `:timestamp` (such as XML serialization), the result is unexpected behavior. Existing schema definitions will continue to work, and the `timestamp` type is transparently aliased to `datetime`.
* Delegate `Column#type` to the injected type objectSean Griffin2014-05-191-12/+14
| | | | | | | | | | | | | | | | The decision to wrap type registrations in a proc was made for two reasons. 1. Some cases need to make an additional decision based on the type (e.g. a `Decimal` with a 0 scale) 2. Aliased types are automatically updated if they type they point to is updated later. If a user or another adapter decides to change the object used for `decimal` columns, `numeric`, and `number` will automatically point to the new type, without having to track what types are aliased explicitly. Everything else here should be pretty straightforward. PostgreSQL ranges had to change slightly, since the `simplified_type` method is gone.
* Add a type object to Column constructorSean Griffin2014-05-171-4/+5
| | | | | | Part of #15134. In order to perform typecasting polymorphically, we need to add another argument to the constructor. The order was chosen to match the `oid_type` on `PostgreSQLColumn`.
* Changed extract_limit in class Column to return correct mysql float and ↵Aaron Nelson2014-05-161-0/+2
| | | | double limits
* Simplify building options hash in rename column method for mysqlCarlos Antonio da Silva2014-05-041-5/+6
|
* Get rid of conditional since column_for handles raising nowCarlos Antonio da Silva2014-05-041-7/+4
| | | | | column_for will raise in case column is not found for the given table, so there is no need to handle that here.
* refactor, move `column_for` to `AbstractAdapter` for better reuse.Yves Senn2014-05-041-8/+1
|
* Stringify variables names for mysql connectionsPaul Nikitochkin2014-04-301-5/+5
| | | | | | | For mysql2/mysql adapters, `sql_mode` variable name set in `database.yml` as string, was ignored and `sql_mode` was set to use strict mode. Fixes #14895
* push the collectors up to the abstract adapterAaron Patterson2014-04-091-20/+0
|
* mysql tests are passing againAaron Patterson2014-04-091-1/+7
|
* all tests passing on mysql2Aaron Patterson2014-04-091-1/+0
|
* working against arel/collector branchAaron Patterson2014-04-091-12/+4
|
* fix bind collecting for mysqlAaron Patterson2014-04-091-2/+22
|
* wrap the literal value before handing it to arelAaron Patterson2014-04-071-1/+2
| | | | this lets arel know how to correctly quote the value
* fix mysql buildsLuke Steensen2014-03-301-1/+1
|
* No need to gsub the stringRafael Mendonça França2014-03-261-1/+1
|
* Don't use send when we own the methodRafael Mendonça França2014-03-261-1/+1
|
* Make method privateRafael Mendonça França2014-03-261-5/+6
|
* Improve the methodRafael Mendonça França2014-03-261-5/+6
| | | | | | * cache `o.name` value * Avoid extra `concat` call * Avoid extra `<<` call
* Fixes bugs for using indexes in CREATE TABLE by adding checks for table ↵Steve Rice2014-03-251-1/+1
| | | | | | | | existence Also: - updates tests by stubbing table_exists? method - adds entry for creating indexes in CREATE TABLE to changelog
* create indexes inline in CREATE TABLE for MySQLCody Cutrer2014-03-251-0/+20
| | | | | | | | This is important, because adding an index on a temporary table after it has been created would commit the transaction Conflicts: activerecord/CHANGELOG.md
* Merge pull request #13040 from kamipo/case_sensitive_comparisonRafael Mendonça França2014-03-121-0/+8
|\ | | | | | | | | | | | | Only use BINARY for mysql case sensitive uniqueness check when column has a case insensitive collation. Conflicts: activerecord/CHANGELOG.md
| * Only use BINARY for mysql case sensitive uniqueness check when column has a ↵Ryuta Kamizono2013-11-261-0/+8
| | | | | | | | case insensitive collation.
* | Replace map.flatten with flat_map in activerecordErik Michaels-Ober2014-03-031-2/+2
| |
* | `execute` is a hotspot, so let's reduce branchesAaron Patterson2014-02-121-6/+2
| |
* | MySQL: remove the old-school 'packets out of order' messageJeremy Kemper2013-12-171-6/+0
| | | | | | | | Blast from the past, MySQL 4 era, when the password hashing style changed.
* | support creating temporary tables from queriesCody Cutrer2013-12-141-0/+4
| | | | | | | | | | also override drop_table in AbstractMySQLAdapter to properly drop temporary tables without committing the transaction
* | Remove `DEFAULT NULL` for primary key column to support MySQL 5.7.3Yasuo Honda2013-12-101-1/+1
| | | | | | | | Since MySQL 5.7.3 m13 does now allow primary key column is null.
* | Remove unused variableRafael Mendonça França2013-11-291-1/+1
| | | | | | | | | | This method is not using the block variable directly since it is calling yield
* | Merge pull request #13100 from akshay-vishnoi/f-refactorCarlos Antonio da Silva2013-11-291-3/+8
|\ \ | | | | | | #type_cast - improve performance & readability
| * | #type_cast - improve performance & readabilityAkshay Vishnoi2013-11-291-3/+8
| |/
* | fix mysql version check in rename_indexCody Cutrer2013-11-281-1/+1
| | | | | | | | also clarify native rename_index support is >= 5.7, not > 5.7
* | implement rename_index natively for MySQL > 5.7Cody Cutrer2013-11-281-0/+8
|/
* Merge pull request #12779 from ↵Aaron Patterson2013-11-151-8/+0
|\ | | | | | | | | dougbarth/dont_swallow_exceptions_during_transactional_statements_in_mysql Don't swallow exceptions in transctional statements
| * Don't swallow exceptions in transctional statementsDoug Barth2013-11-051-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MySQL connection adapater swallows all StandardError exceptions, which includes Mysql::Error and Mysql2::Error. The comment in the exception clause claims errors thrown here indicate that transactions aren't supported by the server but that isn't necessarily true. It's possible the MySQL server has gone away and swallowing a failed commit may let the application return a successful response when the data has not been saved. Also, replication libraries like Galera require that the application handle exceptions thrown at BEGIN/COMMIT. I'm unable to determine what version of MySQL threw an exception for transactional statements. I tried as far back as 3.23.49 with InnoDB disabled but BEGIN & COMMIT statements do not throw an error. If there's a real case for this logic to continue, we could instead push this behavior into a configuration setting. The exception swallowing has been there since the beginning: db045dbbf60b53dbe013ef25554fd013baf88134
* | Unifies mysql and mysql2 casting of booleans.Yves Senn2013-11-111-0/+6
|/
* extract adapter savepoint implementations into `abstract/savepoints.rb`.Yves Senn2013-09-301-17/+2
|
* change the savepoint interface to allow passing the name.Yves Senn2013-09-301-6/+6
|
* Check if the SQL is not a prepared statementRafael Mendonça França2013-09-111-0/+1
| | | | | | | | | When the adapter is with prepared statement disabled and the binds array is not empty the connection adapter will try to set the binds values and will fail. Now we are checking if the adapter has the prepared statement disabled. Fixes #12023
* chmod -xAkira Matsuda2013-08-121-0/+0
|
* Remove redundant `string_to_binary` from type-castingVipul A M2013-08-091-2/+2
|
* Set field encoding to client_encoding for mysql adapter.Koichi Sasada2013-08-081-1/+2
|
* Revert "Merge pull request #11120 from awilliams/ar_mysql2_boolean_quoting"Yves Senn2013-07-171-6/+0
| | | | | This reverts commit cb1d07e43926bcec95cb8b4a663ca9889173395a, reversing changes made to 754a373e301d2df0b12a11083405252722bc8366.