aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge branch 'master' into adequaterecordAaron Patterson2014-03-253-40/+38
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (96 commits) clarify CHANGELOG [ci skip]. Fix Generation of proper migration when ActiveRecord::Base.pluralize_table_names = false. update comments to reflect that options support is not available synchronize changelogs and 4.1 release notes. [ci skip] do not rely on method_missing hitting arel use ARel factory methods for building AST nodes Fix date_select option overwriting html classes - Rename `increment_or_decrement` to an apt `set_cache_value` since it actually doesn't increment/decrement in localstore. Check if any sqlite files are not included in the gitignore Remove sqlite3 lines from .gitignore if the application is not using sqlite3. Adding active_model in Rails::Info Clean up tables after each test. Swapped parameters of assert_equal in assert_select Update test helper to use latest Digestor API Digestor should just rely on the finder to know about the format and the variant -- trying to pass it back in makes a mess of things (oh, and doesnt work) Log the full path, including variant, that the digestor is trying to find Fix for digestor to consider variants for partials -- this still needs more testing!! fix log_tags request object grammar Extract with_example_table into helper method. test for structure:dump without schema information table. refs eafec46 ... Conflicts: activerecord/test/cases/relation/where_chain_test.rb
| * Reap connections based on owning-thread deathMatthew Draper2014-03-181-28/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .. not a general timeout. Now, if a thread checks out a connection then dies, we can immediately recover that connection and re-use it. This should alleviate the pool exhaustion discussed in #12867. More importantly, it entirely avoids the potential issues of the reaper attempting to check whether connections are still active: as long as the owning thread is alive, the connection is its business alone. As a no-op reap is now trivial (only entails checking a thread status per connection), we can also perform one in-line any time we decide to sleep for a connection.
| * No need to binds be optionalRafael Mendonça França2014-03-131-2/+2
| |
| * Make select_all on query cache accept a Relation without binds.Arthur Neves2014-03-132-12/+10
| | | | | | | | | | [fixes #14361] [related #13886]
* | Merge branch 'master' into adequaterecordAaron Patterson2014-02-262-2/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (55 commits) [ci skip] Move association class method notes extract common code in `uuid_test.rb`. move PostgreSQL UUID tests from `datatype_test.rb` to `uuid_test.rb`. [ci skip] remove guide section on models in migrations test case for custom PostgreSQL enum type. Remove inclusion of rubysl gem for rbx on generated Gemfile let `insert_record` actuall save the object. [skip ci] Fix test name typo in app generator tests. travis s/2.1.0/2.1.1 Bump version of bcrypt gem Skip test_migrate_revert_add_index_with_name if databases do not allow to create duplicate indexes on the same columns Optimize getting started guide images, and use png instead of jpg :scissors: [ci skip] Point master changelogs to 4-1-stable branch Add missing parantheses in index_exists? `ActionDispatch::Head` was replaced by `Rack::Head`. Closes #14191. [skip ci] Standardized punctuation. [skip ci] Fix typo in link_to :method option description refactor, with_locale is not needed because I18n is mocked. Fix ActionView label translation for more than 10 nested elements ...
| * Add missing parantheses in index_exists?Yannick Schutz2014-02-251-1/+1
| |
| * Distinguish ConnectionNotEstablished messages: no conn pool for the class, ↵Jeremy Kemper2014-02-221-1/+4
| | | | | | | | or no conn available from the pool
* | Merge branch 'master' into adequaterecordAaron Patterson2014-02-174-7/+22
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (311 commits) Add a missing changelog entry for #13981 and #14035 Revert "Fixed plugin_generator test" implements new option :month_format_string for date select helpers [Closes #13618] add factory methods for empty alias trackers guarantee a list in the alias tracker so we can remove a conditional stop exposing table_joins make most parameters to the AliasTracker required make a singleton for AssociationScope pass the association and connection to the scope method pass the tracker down the stack and construct it in the scope method clean up add_constraints signature remove the reflection delegate remove klass delegator remove railties changes. fixes #14054 remove chain delegate remove scope_chain delegate Add verb to sanitization note fix path shown in mailer's templates updated Travis build status image url fix guide active_support_core_extensions. add Note to String#indent [ci skip] ... Conflicts: activerecord/lib/active_record/associations/join_dependency.rb activerecord/test/cases/associations/association_scope_test.rb
| * Reaper has access to threadsafe active? callKevin Casey2014-02-081-1/+1
| |
| * docs, AR already auto-detects primary keys. Closes #13946. [ci skip]Yves Senn2014-02-051-3/+3
| | | | | | | | | | This behavior was introduced since Rails 3.1 (207f266ccaaa9cd04cd2a7513ae5598c4358b510) but the docs were still out of date.
| * Fix regression on `.select_*` methods.Arthur Neves2014-01-301-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a common pattern: ``` query = author.posts.select(:title) connection.select_one(query) ``` However `.select` returns a ActiveRecord::AssociationRelation, which has the bind information, so we can use that to get the right sql query. Also fix select_rows on postgress and sqlite3 that were not using the binds [fixes #7538] [fixes #12017] [related #13731] [related #12056]
| * Restore ActiveRecord states after a rollback for models w/o callbacksGodfrey Chan2014-01-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression (#13744) that was caused by 67d8bb9. In 67d8bb9, we introduced lazy rollback for records, such that the record's internal states and attributes are not restored immediately after a transaction rollback, but deferred until they are first accessed. This optimization is only performed when the model does not have any transactional callbacks (e.g. `after_commit` and `after_create`). Unfortunately, the models used to test the affected codepaths all comes with some sort of transactional callbacks. Therefore this codepath remains largely untested until now and as a result there are a few issues in the implementation that remains hidden until now. First, the `sync_with_transaction_state` (or more accurately, `update_attributes_from_transaction_state`) would perform the synchronization prematurely before a transaction is finalized (i.e. comitted or rolled back). As a result, when the actuall rollback happens, the record will incorrectly assumes that its internal states match the transaction state, and neglect to perform the restore. Second, `update_attributes_from_transaction_state` calls `committed!` in some cases. This in turns checks for the `destroyed?` state which also requires synchronization with the transaction stae, which causes an infnite recurrsion. This fix works by deferring the synchronization until the transaction has been finalized (addressing the first point), and also unrolled the `committed!` and `rolledback!` logic in-place (addressing the second point). It should be noted that the primary purpose of the `committed!` and `rolledback!` methods are to trigger the relevant transactional callbacks. Since this code path is only entered when there are no transactional callbacks on the model, this shouldn't be necessary. By unrolling the method calls, the intention here (to restore the states when necessary) becomes more clear.
* | run the damn tests @tenderloveAaron Patterson2014-01-171-1/+1
| |
* | change query strategy based on adapterAaron Patterson2014-01-161-0/+6
|/
* Revert "ask the fixture set for the sql statements"Aaron Patterson2014-01-091-5/+1
| | | | | | | | | This reverts commit 026d0555685087845b74dd87a0417b5a164b1c13. Conflicts: activerecord/lib/active_record/fixtures.rb Fixes #13383
* Make change_table use object of current database adapterNishant Modak2014-01-071-5/+5
| | | | | | | | | - Earlier, change_table was creating database-agnostic object. - After this change, it will create correct object based on current database adapter. - This will ensure that create_table and change_table will get same objects. - This makes update_table_definition method public and nodoc. - Fixes #13577 and #13503
* quoting: Check if id is a valid method before using itArthur Neves2013-12-191-1/+3
| | | | | Need to check if valud also respond_to :id before calling it, otherwise things could explode.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2013-12-202-2/+2
|\
| * Typos. return -> returns. [ci skip]Lauro Caetano2013-12-032-2/+2
| |
* | Fix missing closing rdoc tag [ci skip]Carlos Antonio da Silva2013-12-161-1/+1
| |
* | support creating temporary tables from queriesCody Cutrer2013-12-143-15/+32
| | | | | | | | | | also override drop_table in AbstractMySQLAdapter to properly drop temporary tables without committing the transaction
* | `connection.type_to_sql` returns a `String` for unmapped types.Yves Senn2013-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | Closes #13146. This fixes an error when using: ``` change_colum :table, :column, :bigint, array: true ```
* | Currently, we clear query_cache in cache block finish, even if we may ↵Vipul A M2013-12-031-1/+1
| | | | | | | | | | | | already have cache true. This commit takes into account the last cache_enabled value, before clearing query_cache.
* | Remove `DatabaseStatements#case_sensitive_equality_operator`. It has been ↵Ryuta Kamizono2013-11-291-4/+0
| | | | | | | | deprecated already.
* | `rename_index`: add the new index before removing the old one.Yves Senn2013-11-261-2/+2
|/ | | | | | | | | | | This prevents the following error when a MySQL index on a foreign key column is renamed: ``` ActiveRecord::StatementInvalid: Mysql2::Error: Cannot drop index 'index_engines_on_car_id': needed in a foreign key constraint: DROP INDEX `index_engines_on_car_id` ON `engines` ``` refs: #13038.
* Move `SchemaCreation` to its own file instead of `AbstractAdapter`.Vipul A M2013-11-121-0/+83
|
* ask the fixture set for the sql statementsAaron Patterson2013-11-041-1/+5
|
* Remove confusing generated-code commentaryJeremy Kemper2013-10-281-4/+4
|
* extract adapter savepoint implementations into `abstract/savepoints.rb`.Yves Senn2013-09-301-0/+21
|
* Check if the SQL is not a prepared statementRafael Mendonça França2013-09-111-1/+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
* Revert "Do not dup the binds when visiting the AST"Rafael Mendonça França + Kassio Borges2013-08-311-1/+2
| | | | | | This reverts commit 71ff7d9c6592b93e2c810a1f464943dd7bd02c7f. Reason: I need to check with @jeremy if we can do this.
* Do not dup the binds when visiting the ASTRafael Mendonça França2013-08-311-2/+1
| | | | | | | The visitor have to consume the bind parameters to make the statements work when the prepared statement option is disabled. Fixes #12023
* Merge pull request #11827 from vipulnsward/remove_extra_caseSantiago Pastorino2013-08-261-1/+0
|\ | | | | Remove extra case.
| * Remove extra case.Vipul A M2013-08-101-1/+0
| |
* | drop extra variableVipul A M2013-08-121-2/+2
|/
* Remove redundant `string_to_binary` from type-castingVipul A M2013-08-092-4/+0
|
* Merge pull request #11331 from vipulnsward/remove_conditionalAaron Patterson2013-08-071-8/+1
|\ | | | | Remove conditional, results are always an instance of `ActiveRecord::Result`
| * Remove conditional, since results are always an instance of ↵Vipul A M2013-07-061-8/+1
| | | | | | | | `ActiveRecord::Result`
* | Fix indentation.kennyj2013-07-241-8/+8
| |
* | Simplify select_one method.kennyj2013-07-241-2/+1
| | | | | | | | | | | | The select_all method always returns ActiveRecord::Result instance, and the ActiveRecord::Result includes Enumerable mixin. If #empty?, #first method returns nil. Thus we can simplify this method.
* | Defines the return type of select / select_all method.kennyj2013-07-231-4/+2
| |
* | rescue from all exceptions in `ConnectionManagement#call`Vipul A M2013-07-221-1/+1
| | | | | | | | | | | | | | | | | | Fixes #11497 As `ActiveRecord::ConnectionAdapters::ConnectionManagement` middleware does not rescue from Exception (but only from StandardError), the Connection Pool quickly runs out of connections when multiple erroneous Requests come in right after each other. Recueing from all exceptions and not just StandardError, fixes this behaviour.
* | Move initializing process for query cache to ↵kennyj2013-07-161-0/+6
|/ | | | ActiveRecord::ConnectionAdapters::QueryCache module.
* Removed deprecated method `columns_for_remove`Neeraj Singh2013-07-031-6/+0
|
* Remove deprecated SchemaStatements#distinctFrancesco Rodriguez2013-07-021-9/+0
|
* Remove deprecated AR::Connection#clear_stale_cached_connections! methodFrancesco Rodriguez2013-07-011-5/+0
|
* Fix documents for create_join_tableSatoshi Ebisawa2013-06-211-2/+2
|
* Merge pull request #10425 from ↵Rafael Mendonça França2013-06-132-11/+3
|\ | | | | | | | | ranjaykrishna/push_add_column_options_to_schema_creation Push add column options to schema creation
| * Moving add_column_options! up to SchemaCreationjeran2013-06-122-11/+3
| | | | | | | | | | | | | | | | removed two instances of add_column_options! from abstract_mysql_adapter reworked rename_column_sql to remove add_column_options from schema_statements changed to use new hash syntax.
* | Fixes #10432 add_column not creating array columns in PostgreSQLAdam Anderson2013-06-041-0/+1
| | | | | | | | | | | | When then PostgreSQL visitor was [added](https://github.com/rails/rails/commit/6b7fdf3bf3675a14eae74acc5241089308153a34) `add_column` was no longer receiving the column options directly. This caused the options to be lost along the way.