aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* Make connection pool retrieval fasterJon Leighton2012-08-311-10/+13
| | | | | | * Loop rather than recurse in retrieve_connection_pool * Key the hash by class rather than class name. This avoids creating unnecessary strings.
* use Hash#fetch to eliminate conditionalAaron Patterson2012-08-241-8/+3
|
* Refactor AR::Result or inherits. Because we have redundant codes aboutkennyj2012-08-222-16/+2
|
* This method is useless without a block, so remove testAaron Patterson2012-08-201-11/+9
|
* remove unused variableAaron Patterson2012-08-201-1/+1
|
* initialize instance variables to avoid conditionalsAaron Patterson2012-08-201-2/+7
|
* column default extraction should handle newlines.Aaron Patterson2012-08-171-2/+2
| | | | Fixes #7374
* Fix occasional microsecond conversion inaccuracyAri Pollak2012-08-151-2/+2
| | | | | | | | | ActiveRecord::ConnectionAdapters::Column#microseconds did an unnecessary conversion to from Rational to float when calculating the integer number of microseconds. Some terminating decimal numbers in base10 are repeating decimal numbers in base2 (the format of float), and occasionally this causes a rounding error. Patch & explanation originally from Logan Bowers.
* load active_support/deprecation in active_support/railsXavier Noria2012-08-023-3/+0
|
* load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-023-3/+0
|
* Deprecate Relation#all.Jon Leighton2012-07-271-1/+1
| | | | | | It has been moved to active_record_deprecated_finders. Use #to_a instead.
* Merge pull request #6654 from stevecj/postgresql-auto-reconnect-2Aaron Patterson2012-07-251-1/+2
|\ | | | | Postgresql auto reconnect 2
| * Simulated & actual (manual/skipped) PostgreSQL auto-reconnection tests.Steve Jorgensen2012-07-161-0/+1
| |
| * Don't crash exception translation w/ nil result attribute.Steve Jorgensen2012-07-161-1/+1
| | | | | | | | | | | | Exception.result is nil when attempting a query after PostgreSQL disconnect, resulting in new exception: NoMethodError: undefined method `error_field' for nil:NilClass
* | Add fkey attributes to `join_table` migration generatorAleksey Magusev2012-07-191-3/+3
| |
* | revert Default timestamps to non-nullDave Kroondyk2012-07-181-1/+1
| | | | | | | | | | | | | | Commit 3dbedd2 added NOT NULL constraints to timestamps. Commit fcef728 started to revert this, but was incomplete. With this commit, 3dbedd2 should be fully reverted and timestamps will no longer default to NOT NULL.
* | Merge pull request #7028 from lexmag/join_table_indexesJosé Valim2012-07-181-2/+5
|\ \ | |/ |/| Add indexes to create_join_table method
| * Add join table migration generatorAleksey Magusev2012-07-181-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | For instance, running rails g migration CreateMediaJoinTable artists musics:uniq will create a migration with create_join_table :artists, :musics do |t| # t.index [:artist_id, :music_id] t.index [:music_id, :artist_id], unique: true end
* | teaching the mysql adapter how to typecast strings returned from the databaseAaron Patterson2012-07-131-2/+132
| |
* | Fixing texts; down to three failing tests.Jeremy Cole2012-07-132-15/+24
| | | | | | | | | | Conflicts: activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
* | Only use prepared statements when bind variables are presentJeremy Cole2012-07-131-34/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prepared statements (prepare/execute/close) were being used unnecessarily when no bind variables were present, and disabling prepared statement using prepared_statements:false was principally broken. While bind variables were correctly substituted with prepared_statements:false, the prepared statement interface was still used, costing an extra two round trips per query. In addition to making this behavioral change, I also cleaned up the internals of exec_stmt and exec_without_stmt so that they behave the same (calling log and constructing the ActiveRecord::Result in the same way). Moving the check for binds.empty? to exec_query also will mean that several code paths explicitly calling exec_without_stmt could be cleaned up to once again call exec_query instead. I have also left the check for binds.empty? in exec_stmt, since it is not a private method and could be called directly with an empty binds array. For the sake of clarity in this patch, I have not made those changes. = The previous behavior = When issuing a Foo.find(1) with prepared_statements:true, the bind variable is present in the prepared query, and execute shows a value passed: Connect root@localhost on rails_test Query SET SQL_AUTO_IS_NULL=0 Statistics Query SHOW FULL FIELDS FROM `foos` Query SHOW TABLES LIKE 'foos' Query SHOW CREATE TABLE `foos` Prepare SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = ? LIMIT 1 Execute SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Close stmt Quit When issuing a Foo.find(1) with prepared_statements:false, the bind variable has already been removed and substituted with the value, but the prepared statement interface is used anyway: Connect root@localhost on rails_test Query SET SQL_AUTO_IS_NULL=0 Statistics Query SHOW FULL FIELDS FROM `foos` Query SHOW TABLES LIKE 'foos' Query SHOW CREATE TABLE `foos` Prepare SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Execute SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Close stmt Quit = With this patch applied = When issuing a Foo.find(1) with prepared_statements:true, the bind variable is present in the prepared query, and execute shows a value passed: Connect root@localhost on rails_test Query SET SQL_AUTO_IS_NULL=0 Statistics Query SHOW FULL FIELDS FROM `foos` Query SHOW TABLES LIKE 'foos' Query SHOW CREATE TABLE `foos` Prepare SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = ? LIMIT 1 Execute SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Close stmt Quit When issuing a Foo.find(1) with prepared_statements:false, the bind variable has been removed and substituted with the value, and the query interface is used instead of the prepared statement interface: Connect root@localhost on rails_test Query SET SQL_AUTO_IS_NULL=0 Statistics Query SHOW FULL FIELDS FROM `foos` Query SHOW TABLES LIKE 'foos' Query SHOW CREATE TABLE `foos` Query SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Quit
* | Merge pull request #6874 from robbkidd/rename_sequences_tooAaron Patterson2012-07-101-0/+7
|\ \ | |/ |/| Rename default sequence when table is renamed? [AR:postgres]
| * Update psql adapter to rename a default pkey sequence when renaming a table.Robb Kidd2012-06-271-0/+7
| |
* | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-07-071-2/+4
|\ \
| * | fix AR::SchemaStatements#column_exists? example [ci skip]Francesco Rodriguez2012-06-301-1/+1
| | |
| * | update AR::SchemaStatements#column_exists? documentation [ci skip]Francesco Rodriguez2012-06-301-2/+4
| | |
* | | Refactor locked? method in query cacheCarlos Antonio da Silva2012-07-071-5/+2
| | | | | | | | | | | | Introduced in 75b340d1a4bcf2f1233fb65a15ff6b8059e2230e
* | | Disable query cache for lock queriesDamir Zekic2012-07-061-1/+9
| | | | | | | | | | | | Fixes #867
* | | fix quoting for ActiveSupport::Duration instancesFrancesco Rodriguez2012-07-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes quoting for ActiveSupport::Duration instances: # before >> ActiveRecord::Base.connection.quote 30.minutes => "'--- 1800\n...\n'" # after >> ActiveRecord::Base.connection.quote 30.minutes => "1800" Also, adds a test for type casting ActiveSupport::Duration instances. Related to #1119.
* | | Don't need to use delete in the options hashRafael Mendonça França2012-07-032-3/+2
| | |
* | | Refactor references schema definitionsAleksey Magusev2012-07-031-18/+12
| | |
* | | Add references schema statementsAleksey Magusev2012-07-031-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Examples: add_reference :products, :supplier, polymorphic: true, index: true remove_reference :products, :user `add_belongs_to` and `remove_belongs_to` are acceptable.
* | | Unify the collation API for the database adptersRafael Mendonça França2012-07-011-4/+4
| | |
* | | Merge pull request #6913 from lexmag/column_exists_optionsCarlos Antonio da Silva2012-06-301-4/+6
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | Add :default and :null options to column_exists? method Examples: column_exists?(:testings, :taggable_id, :integer, null: false) column_exists?(:testings, :taggable_type, :string, default: 'Photo')
| * | Add more options to column_exists? methodAleksey Magusev2012-06-301-4/+6
| |/ | | | | | | Also fix failures in check options for nil
* | Require URIChris Bandy2012-06-281-0/+2
| |
* | Support collate and ctype on the PostgreSQL.kennyj2012-06-291-1/+20
| |
* | fix: limit of enum columns of mysqlYamada Masaki2012-06-281-0/+2
|/
* Revert "Merge pull request #6344"Piotr Sarnacki2012-06-251-1/+1
| | | | | | | | | | | | | | This commit needs to be reverted because it introduces difficulties when using sqlite3 in development and other databases in production. This happens because when you create time column in sqlite3, it's dumped as datetime in schema.rb file. This reverts commit 57d534ee9e441d078fcc161c0c78ebaa5aacd736, reversing changes made to 20f049fb50daee0c5e5a69b55b529af5737e8e3f. Conflicts: activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
* add :nodoc: to internal implementations [ci skip]Francesco Rodriguez2012-06-221-1/+1
|
* Allow precision option for postgresql datetimesTony Schneider2012-06-221-0/+10
| | | | | | | | | | This patch addresses the difficulty of retrieving datetime fields. By default, the database holds a higher precision than the time as a String. This issue is discussed at length at the following links: - [#3519](https://github.com/rails/rails/issues/3519) - [#3520](https://github.com/rails/rails/issues/3520) Also, kudos to @mattscilipoti
* Change minimum (default) log level in PostgreSQL to warning.kennyj2012-06-181-1/+1
|
* Avoid unnecessary catching of Exception instead of StandardError.Dylan Smith2012-06-173-6/+6
|
* Simplify AR configuration code.Jon Leighton2012-06-151-6/+8
| | | | | Get rid of ActiveModel::Configuration, make better use of ActiveSupport::Concern + class_attribute, etc.
* Add uuid type support to PostgreSQL adapterKonstantin Shabanov2012-06-142-3/+8
|
* Merge pull request #6492 from pmahoney/fair-connection-pool2Rafael Mendonça França2012-06-111-37/+174
|\ | | | | | | | | | | | | Fair connection pool2 Conflicts: activerecord/test/cases/associations/eager_test.rb
| * Make connection pool fair with respect to waiting threads.Patrick Mahoney2012-05-251-37/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The core of this fix is a threadsafe, fair Queue class. It is very similar to Queue in stdlib except that it supports waiting with a timeout. The issue this solves is that if several threads are contending for database connections, an unfair queue makes is possible that a thread will timeout even while other threads successfully acquire and release connections. A fair queue means the thread that has been waiting the longest will get the next available connection. This includes a few test fixes to avoid test ordering issues that cropped up during development of this patch.
* | Symbol responds_to :upcase & :downcase in Ruby >= 1.9Akira Matsuda2012-06-061-1/+1
| |
* | Work around undiagnosed bug that's draining a relation's bind_valuesJeremy Kemper2012-05-311-0/+1
| |
* | Merge pull request #6477 from steveklabnik/close_discovered_pg_connectionRafael Mendonça França2012-05-301-1/+2
|\ \ | | | | | | Properly discover a connection is closed in postgresql_adapter