aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract
Commit message (Collapse)AuthorAgeFilesLines
* fix bug on non empty defaults for pg array columnsLuke Steensen2014-03-302-2/+8
| | | | fixes #10613
* No need to call to_symRafael Mendonça França2014-03-301-2/+2
| | | | It is already called inside type_to_sql method.
* Replace trivial regexp with string or index, twice as fastKelley Reynolds2014-03-281-1/+1
|
* Don't use send when we own the methodRafael Mendonça França2014-03-261-34/+34
|
* Invert the conditionals to make easier to readRafael Mendonça França2014-03-261-4/+4
| | | | Also improve some of the code conventions
* 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-11/+10
| | | | | | | | This is important, because adding an index on a temporary table after it has been created would commit the transaction Conflicts: activerecord/CHANGELOG.md
* 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]
* 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
* 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.
* 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