aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* active_record: Quote numeric values compared to string columns.Dylan Smith2013-02-072-4/+8
|
* Call super to use the abstract adapter implementation insteadCarlos Antonio da Silva2013-02-061-1/+1
|
* Add changelog entry for #9203 about schema dumper with db extensionsCarlos Antonio da Silva2013-02-061-2/+2
| | | | [ci skip]
* add ActiveRecord::AbstractAdapter#extensions and ↵Justin George2013-02-062-0/+15
| | | | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#extensions to allow dumping of enabled extensions to schema.rb, add ActiveRecord::SchemaDumper#extensions to dump extensions to schema.rb
* Fix typo :bomb:Rafael Mendonça França2013-01-311-1/+1
|
* Fix typoRafael Mendonça França2013-01-311-2/+2
|
* Strict regexpRafael Mendonça França2013-01-311-2/+2
|
* Extract the value casting to a methodRafael Mendonça França2013-01-311-15/+23
|
* DATABASE_URL parsing should turn numeric strings into numeric types, andAaron Stone2013-01-311-0/+19
| | | | | | the strings true and false into boolean types, in order to match how YAML would parse the same values from database.yml and prevent unexpected type errors in the database adapters.
* reloading type map on extension changingAaron Patterson2013-01-292-2/+15
|
* fixing commentAaron Patterson2013-01-291-1/+1
|
* Fix typoRafael Mendonça França2013-01-291-1/+1
|
* Only search for enabled extension if the PostgreSQL version supportsRafael Mendonça França2013-01-291-3/+5
| | | | extensions
* add API to pg for enabling / disabling hstoreAaron Patterson2013-01-282-0/+25
|
* updates a dynamic method heredoc docXavier Noria2013-01-281-2/+2
|
* explains why the query cache checks arel.lockedXavier Noria2013-01-281-0/+2
|
* Fix typo: adaptors => adapters [ci skip]Carlos Antonio da Silva2013-01-271-1/+1
|
* Fix cases where delete_records on a has_many association caused errorsDerek Kraan2013-01-273-0/+20
| | | | | | | | | | | | | because of an ambiguous column name. This happened if the association model had a default scope that referenced a third table, and the third table also referenced the original table (with an identical foreign_key). Mysql requires that ambiguous columns are deambiguated by using the full table.column syntax. Postgresql and Sqlite use a different syntax for updates altogether (and don't tolerate table.name syntax), so the fix requires always including the full table.column and discarding it later for Sqlite and Postgresql.
* Default dead_connection_timeout to 5Akira Matsuda2013-01-241-1/+1
| | | | or the ConnectionPool silently fails to close connections inside the Thread
* Fix PostgreSQL tests on TravisAndrew White2013-01-241-0/+5
| | | | Travis only has PostgreSQL 9.1.x but 9.2 is required for range datatypes.
* Add postgresql range types supportbUg2013-01-237-71/+117
|
* Refactored transaction state into its own object. Each transaction creates a ↵wangjohn2013-01-211-5/+24
| | | | new transaction state object upon initialization.
* Created state for a transaction and added tests.wangjohn2013-01-201-0/+12
|
* fix anonymous class issueDavid2013-01-201-0/+1
|
* Don't rely on Hash key's orderingVitor Baptista2013-01-162-3/+5
| | | | | | | | | | | | | | | | | | | If we set encoding latin1 for a PostgreSQL database, it calls PostgreSQLAdapter::create_database with options that have, among other things: { 'encoding' => 'latin1' } Then, we use reverse_merge(:encoding => "utf8") to setup the default encoding. In the end, the hash looks like: { :encoding => 'utf8', 'encoding' => 'latin1' } The call to options.symbolize_keys calls to_sym on each_key of this Hash. It usually means that the encoding passed overwrites the default utf8, but it's not guaranteed. So, we shouldn't rely on it. The same was happening in ActiveRecord::ConnectionHandling.
* Use whitelist to pass valid connection parameters to PGConn.Rafael Mendonça França2013-01-061-7/+10
| | | | | | | | | All the valids parameters for libpq are used. See http://www.postgresql.org/docs/9.1/static/libpq-connect.html for the full list Fixes #8784
* Remove the configuration key in the correct placeRafael Mendonça França2013-01-061-3/+1
|
* Fix error when assigning NaN to an integer columnTristan Harward2013-01-061-5/+1
| | | | | | | | | Also covers any non-castable case by returning nil, which is in-line with the intention of the former implementation, but covers the odd cases which respond to to_i but raise an error when it's called, such as NaN, Infinity and -Infinity. Fixes #8757
* These are already required through AS/railsAkira Matsuda2013-01-073-4/+0
| | | | | | * dependencies/autoload * concern * deprecation
* Remove unnecessary begin..rescue..end, use only rescueAkira Matsuda2013-01-061-25/+23
|
* Support for PostgreSQL's ltree data type.Rob Worley2013-01-042-1/+9
|
* Reuse the Column integer converterRafael Mendonça França2013-01-031-1/+1
|
* Fix undefined method `to_i' introduced since 3.2.8Jason Stirk2013-01-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes a bug introduced in 96a13fc7 which breaks behaviour of integer fields. In 3.2.8, setting the value of an integer field to a non-integer (eg. Array, Hash, etc.) would default to 1 (true) : # 3.2.8 p = Post.new p.category_id = [ 1, 2 ] p.category_id # => 1 p.category_id = { 3 => 4 } p.category_id # => 1 In 3.2.9 and above, this will raise a NoMethodError : # 3.2.9 p = Post.new p.category_id = [ 1, 2 ] NoMethodError: undefined method `to_i' for [1, 2]:Array Whilst at first blush this appear to be sensible, it combines in bad ways with scoping. For example, it is common to use scopes to control access to data : @collection = Posts.where(:category_id => [ 1, 2 ]) @new_post = @collection.new In 3.2.8, this would work as expected, creating a new Post object (albeit with @new_post.category_id = 1). However, in 3.2.9 this will cause the NoMethodError to be raised as above. It is difficult to avoid triggering this error without descoping before calling .new, breaking any apps running on 3.2.8 that rely on this behaviour. This patch deviates from 3.2.8 in that it does not retain the somewhat spurious behaviour of setting the attribute to 1. Instead, it explicitly sets these invalid values to nil : p = Post.new p.category_id = [ 1, 2 ] p.category_id # => nil This also fixes the situation where a scope using an array will "pollute" any newly instantiated records. @new_post = @collection.new @new_post.category_id # => nil Finally, 3.2.8 exhibited a behaviour where setting an object to an integer field caused it to be coerced to "1". This has not been retained, as it is spurious and surprising in the same way that setting Arrays and Heshes was : c = Category.find(6) p = Post.new # 3.2.8 p.category_id = c p.category_id # => 1 # This patch p.category_id = c p.category_id # => nil This commit includes explicit test cases that expose the original issue with calling new on a scope that uses an Array. As this is a common situation, an explicit test case is the best way to prevent regressions in the future. It also updates and separates existing tests to be explicit about the situation that is being tested (eg. AR objects vs. other objects vs. non-integers)
* small refactoring, added blob_or_text_colum? in AbstractMysqlAdapterAngelo Capilleri2012-12-281-2/+6
|
* Fixes for PR [#8267]Marc-Andre Lafortune2012-12-221-3/+6
| | | | | | | | * Fix Migration#reversible by not using `transaction`. * Adapt mysql adapter to updated api for remove_column * Update test after aedcd683684d08eaf30623a4b48ce31a31426372
* Fix calling quote column name in interpolated stringCarlos Antonio da Silva2012-12-211-1/+1
|
* Differentiate between remove_column and remove_columns. Make remove_column ↵Marc-Andre Lafortune2012-12-213-14/+23
| | | | | | reversible. [#8267]
* Make drop_table reversible [#8267]Marc-Andre Lafortune2012-12-211-0/+4
|
* Add drop_join_table [#8267]Marc-Andre Lafortune2012-12-211-0/+11
|
* Simplify change_table and avoid duplicated logicMarc-Andre Lafortune2012-12-211-14/+2
|
* Keep index names when using with sqlite3Yves Senn2012-12-191-2/+1
|
* #5523 Add ability for postgresql adapter to disable user triggers in ↵Gary S. Weaver2012-12-181-4/+12
| | | | disable_referential_integrity.
* AR supporting new int4range and int8range data type on PostgreSQL >= 9.2. ↵Alexey2012-12-171-4/+11
| | | | Fix realization
* AR supporting new intrange data type on PostgreSQL >= 9.2Alexey2012-12-166-4/+68
|
* Merge pull request #8510 from thedarkone/thread_safety_improvementsAaron Patterson2012-12-141-9/+16
|\ | | | | Thread safety improvements
| * Replace some global Hash usages with the new thread safe cache.thedarkone2012-12-141-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary of the changes: * Add thread_safe gem. * Use thread safe cache for digestor caching. * Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation. * Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache. * Use TS::Cache to avoid the synchronisation overhead on listener retrieval. * Replace synchronisation with TS::Cache usage. * Use a preallocated array for performance/memory reasons. * Update the controllers cache to the new AS::Dependencies::ClassCache API. The original @controllers cache no longer makes much sense after @tenderlove's changes in 7b6bfe84f3 and f345e2380c. * Use TS::Cache in the connection pool to avoid locking overhead. * Use TS::Cache in ConnectionHandler.
* | Deprecate obsolete Time to DateTime fallback methodsAndrew White2012-12-111-1/+1
|/ | | | | | | The Time.time_with_datetime_fallback, Time.utc_time and Time.local_time methods were added to handle the limitations of Ruby's native Time implementation. Those limitations no longer apply so we are deprecating them in 4.0 and they will be removed in 4.1.
* Move to the schema-migrations-metadata branch.Jeremy Kemper2012-12-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | Pending work on graceful app upgrades. Revert "Merge pull request #8439 from joshsusser/fixes" This reverts commit ce8ac39338f86388e70356b3a470b3ea443802ae, reversing changes made to b0e7b6f67c984d4b1502e801781ed75fad681633. Revert "Merge pull request #8431 from joshsusser/schemadump" This reverts commit 036d3e1c2b65c4b8cbd23de2e20ad67b9b756182, reversing changes made to 0c692f4d121792117b6a71e5ed590a31c3b9d12e. Revert "Merge branch 'joshsusser-master' into merge" This reverts commit 0c692f4d121792117b6a71e5ed590a31c3b9d12e, reversing changes made to 2e299fca715b083a60222a85e48f9d3b8dd8ce93. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb activerecord/test/cases/schema_dumper_test.rb
* Session variables for mysql, mysql2, and postgresql adapters can be setAaron Stone2012-12-084-34/+61
| | | | | | | | | in the new 'variables:' hash in each database config section in database.yml. The key-value pairs of this hash will be sent in a 'SET key = value, ...' query on new database connections. The configure_connection methods from mysql and mysql2 into are consolidated into the abstract_mysql base class.
* revises a RDoc example to make it idiomaticXavier Noria2012-12-071-8/+8
| | | | | | The force flag suggests the original was probably copied from some db/schema.rb. Thanks to Josh Susser for spotting and reporting this.