aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* Remove Relation#bind_paramsSean Griffin2015-01-276-26/+14
| | | | | | | | `bound_attributes` is now used universally across the board, removing the need for the conversion layer. These changes are mostly mechanical, with the exception of the log subscriber. Additional, we had to implement `hash` on the attribute objects, so they could be used as a key for query caching.
* Errors raised in `type_cast_for_database` no longer raise on assignmentSean Griffin2015-01-231-1/+1
| | | | Fixes #18580.
* Don't error when invalid json is assigned to a JSON columnSean Griffin2015-01-211-1/+1
| | | | | | | Keeping with our behavior elsewhere in the system, invalid input is assumed to be `nil`. Fixes #18629.
* TransactionManager should call rollback recordsArthur Neves2015-01-201-5/+5
|
* Merge pull request #18458 from brainopia/fix_after_commit_for_fixturesJeremy Kemper2015-01-201-4/+11
|\ | | | | Support after_commit callbacks in transactional fixtures
| * after_commit runs after transactions with non-joinable parentsbrainopia2015-01-161-4/+11
| | | | | | | | | | | | after_commit callbacks run after committing a transaction whose parent is not `joinable?`: un-nested transactions, transactions within test cases, and transactions in `console --sandbox`.
* | Add an `:if_exists` option to `drop_table`Stefan Kanev2015-01-193-3/+3
|/ | | | | | | | | | | If set to `if_exists: true`, it generates a statement like: DROP TABLE IF EXISTS posts This syntax is supported in the popular SQL servers, that is (at least) SQLite, PostgreSQL, MySQL, Oracle and MS SQL Sever. Closes #16366.
* Time columns should support time zone aware attributesSean Griffin2015-01-151-1/+1
| | | | | | The types that are affected by `time_zone_aware_attributes` (which is on by default) have been made configurable, in case this is a breaking change for existing applications.
* Don't default to YAML dumping when quoting valuesSean Griffin2015-01-142-3/+8
| | | | | | | This behavior exists only to support fixtures, so we should handle it there. Leaving it in `#quote` can cause very subtle bugs to slip through, by things appearing to work when they should be blowing up loudly, such as #18385.
* Merge pull request #18478 from ↵Sean Griffin2015-01-131-1/+2
|\ | | | | | | | | yoshiokatsuneo/active_record_connection_pool_error_disconnect ActiveRecord: On reconnection failure, release only failed connetion.
| * ActiveRecord: On reconnection failure, release only failed connetion.Yoshioka Tsuneo2015-01-131-1/+2
| | | | | | | | | | | | | | On reconnection failure, all the connection was released. But, it is better to release only failed connection. This patch changes not to release all the connection but release only failed connection.
* | Deprecate passing a column to `quote`Sean Griffin2015-01-101-0/+6
| | | | | | | | | | It's only used to grab the type for type casting purposes, and we would like to remove the type from the columns entirely.
* | Stop passing a column to `quote` when prepared statements are turned offSean Griffin2015-01-102-4/+5
| | | | | | | | | | | | | | I'm planning on deprecating the column argument to mirror the deprecation in [arel]. [arel]: https://github.com/rails/arel/commit/6160bfbda1d1781c3b08a33ec4955f170e95be11
* | Stop passing a column to `quote` in `insert_fixture`Sean Griffin2015-01-102-4/+14
| | | | | | | | | | | | | | I'm planning on deprecating the column argument to mirror the deprecation in [arel]. [arel]: https://github.com/rails/arel/commit/6160bfbda1d1781c3b08a33ec4955f170e95be11
* | Fix typo in PostresSQLAdapter's documentationSebastian Staudt2015-01-101-1/+1
| |
* | Copy records to parent transaction should happen on TransactionManagerArthur Neves2015-01-091-3/+3
| | | | | | | | It is up to the TransactionManager keep the state of current transaction, so after it commits it needs to copy any remaning record to the next current transaction
* | Use keyword args on committed! and rolledback!Arthur Neves2015-01-091-3/+3
|/ | | | As discussed before, those methods should receive a keyword args instead of just parameters
* ActiveRecord: release connection on reconnect failure.Yoshioka Tsuneo2015-01-091-0/+3
| | | | | | | | | | | | | | | | | | When trying to checkout connection from connection pool, checkout()(and checkout_and_verify) verify whether the connection is active or not. And, if the connection is not active, connection adapters try to reconnect to server. And, if database is down at this moment, reconnect fails and exception is raised. (Ex: Mysql2::Error: Can't connect to local MySQL server through socket xxx) But, ConnectionPool does not catch the exception, but leaks current disconnected connection to @connection. So, if database's temporary down happens several times and exceeds the number of connection pool(5 by default), activerecord will be no more available, even if database server is already recovered. This patch fix it by catching exception and releasing connection.
* Fix count on a separate connection (fixes #18359)brainopia2015-01-081-1/+1
| | | | | | | | Previosly count and other AR calculations would convert column_name_for_operation to sql on a default Arel::Table.engine (AR::Base) connection. That could lead to trouble if current model has a connection to a different adapter or Base connection is inaccessible.
* remove deprecated support for PG ranges with exclusive lower bounds.Yves Senn2015-01-051-10/+1
| | | | addresses https://github.com/rails/rails/commit/91949e48cf41af9f3e4ffba3e5eecf9b0a08bfc3#commitcomment-9144563
* Change the behavior of boolean columns to be closer to Ruby's semantics.Rafael Mendonça França2015-01-041-1/+0
| | | | | | | | Before this change we had a small set of "truthy", and all others are "falsy". Now, we have a small set of "falsy" values and all others are "truthy" matching Ruby's semantics.
* Change transaction callbacks to not swallowing errors.Rafael Mendonça França2015-01-041-12/+2
| | | | | | | | Before this change any error raised inside a transaction callback are rescued and printed in the logs. Now these errors are not rescue anymore and just bubble up, as the other callbacks.
* Remove deprecated access to connection specification using a string acessor.Rafael Mendonça França2015-01-041-20/+1
| | | | Now all strings will be handled as a URL.
* Change the default `null` value for `timestamps` to `false`Rafael Mendonça França2015-01-043-18/+5
|
* Return an array of pools from `connection_pools`Rafael Mendonça França2015-01-041-10/+1
|
* Return a null column from `column_for_attribute` when no column exists.Rafael Mendonça França2015-01-041-0/+6
| | | | | | | | This reverts commit ae96f229f6501d8635811d6b22d75d43cdb880a4. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/attribute_methods.rb
* Merge pull request #18319 from kamipo/sql_type_has_been_determinedRafael Mendonça França2015-01-041-4/+2
|\ | | | | `sql_type` has been determined already when quoting defaults
| * `sql_type` has been determined already when quoting defaultsRyuta Kamizono2015-01-041-4/+2
| | | | | | | | No need to call `type_to_sql` again.
* | Merge pull request #18318 from ↵Rafael Mendonça França2015-01-041-1/+2
|\ \ | | | | | | | | | | | | kamipo/stop_passing_the_column_when_quoting_defaults Stop passing the column to the `quote` method when quoting defaults
| * | Stop passing the column to the `quote` method when quoting defaultsRyuta Kamizono2015-01-041-1/+2
| |/ | | | | | | Related the commit 8f8f8058e58dda20259c1caa61ec92542573643d.
* / Prefer `array?` rather than `array`Ryuta Kamizono2015-01-043-8/+7
|/ | | | | | Slightly refactoring `PostgreSQLColumn`. `array` should be readonly. `default_function` should be initialized by `super`. `sql_type` has been removed `[]`. Since we already choose to remove it we should not change.
* Merge pull request #17822 from kamipo/refactor_visit_change_column_definitionRafael Mendonça França2015-01-024-16/+14
|\ | | | | Refactor `visit_ChangeColumnDefinition`
| * Refactor `visit_ChangeColumnDefinition`Ryuta Kamizono2015-01-032-11/+9
| | | | | | | | `visit_ChangeColumnDefinition` is the same "CHANGE column_name " + `visit_ColumnDefinition(o)`.
| * Add default value for `create_table_definition`Ryuta Kamizono2015-01-033-5/+5
| | | | | | | | | | In most cases, `create_table_definition` called by table_name (the first argument) only.
* | Merge pull request #8547 from printercu/patch-1Rafael Mendonça França2015-01-021-1/+6
|\ \ | |/ |/| | | | | | | | | | | fix for messages in invalid encoding from db-drivers Conflicts: activerecord/lib/active_record/connection_adapters/abstract_adapter.rb activerecord/test/cases/connection_adapters/abstract_adapter_test.rb
| * fix for messages in invalid encoding from db-driversMax Melentiev2013-12-071-1/+5
| |
* | Merge pull request #17820 from fw42/restore_query_cache_on_rollbackRafael Mendonça França2015-01-027-9/+17
|\ \ | | | | | | | | | Clear query cache on rollback
| * | Restore query cache on rollbackFlorian Weingarten2014-12-017-9/+17
| | |
* | | Merge pull request #18228 from kamipo/correctly_dump_primary_keyRafael Mendonça França2015-01-024-0/+37
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Improve a dump of the primary key support. Conflicts: activerecord/CHANGELOG.md
| * | | Improve a dump of the primary key support.Ryuta Kamizono2014-12-294-0/+37
| | | | | | | | | | | | | | | | If it is not a default primary key, correctly dump the type and options.
* | | | Merge pull request #18067 from ↵Rafael Mendonça França2015-01-021-0/+28
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kamipo/format_datetime_string_according_to_precision Format the datetime string according to the precision of the datetime field. Conflicts: activerecord/CHANGELOG.md
| * | | | Format the datetime string according to the precision of the datetime field.Ryuta Kamizono2015-01-021-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Incompatible to rounding behavior between MySQL 5.6 and earlier. In 5.5, when you insert `2014-08-17 12:30:00.999999` the fractional part is ignored. In 5.6, it's rounded to `2014-08-17 12:30:01`: http://bugs.mysql.com/bug.php?id=68760
| * | | | Allow precision option for MySQL datetimes.Ryuta Kamizono2015-01-021-0/+12
|/ / / /
* | | | Merge pull request #18080 from korbin/fix_reaping_frequency_configurationRafael Mendonça França2015-01-021-1/+1
|\ \ \ \ | | | | | | | | | | | | | | | Fix issue with reaping_frequency type.
| * | | | fix issue with reaping_frequency typekorbin2014-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using DATABASE_URL to configure ActiveRecord, :reaping_frequency does not get converted from a string to a numeric value. This value is eventually passed to 'sleep' and must be numeric to avoid exceptions. This commit converts :reaping_frequency to a float when present.
* | | | | 💣 I forgot to commit the arity changeSean Griffin2015-01-011-1/+1
| | | | |
* | | | | Don't load an entire table into memory to copy it on SQLiteSean Griffin2015-01-011-15/+4
| | | | | | | | | | | | | | | | | | | | SQL has mechanisms we can use to copy data from one table into another.
* | | | | Stop passing the column to the connection adapter when quoting defaultsSean Griffin2015-01-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The column is no longer used for anything besides type casting, which is what we're trying to remove from the column entirely.
* | | | | Extract the index length validation to a auxiliar methodRafael Mendonça França2014-12-303-9/+12
| | | | |
* | | | | Raise a better exception for renaming long indexes for mysql adaptersYasuo Honda2014-12-301-0/+3
| | | | |