aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* Backport PostgreSQL auto-reconnect test coverageSteve Jorgensen2012-09-131-0/+1
| | | | | | | | | | | | | | | | 6d5f4de4c420ebb906109668f5702a537ac77692 Simulated & actual (manual/skipped) PostgreSQL auto-reconnection tests. 4b1bca04025a66c54e6e9d5eb6e4d4056bfa92f0 Stop being silly with formatting of method aliasing. c381d5cbf959208adeb38e7859ee815dfbd2cf54 Fix just-plain-wrongness of psql auto-reconnect test. 1e17a9d367c54c680368be72f44247ae28b98904 Fix only-once stub logic. f16c2043826ec1991cf94fe17cb671507b7a7f51 Changelog for PostgreSQL auto-reconnect test coverage backport.
* Merge pull request #7582 from tchandy/fix_type_cast_codeRafael Mendonça França2012-09-091-2/+2
|\ | | | | type_cast_code should always convert values to integer calling #to_i
| * ConnectionAdapters::Column.type_cast_code should always convert values to ↵Thiago Pradi2012-09-091-2/+2
| | | | | | | | integer calling #to_i
* | Merge pull request #7337 from adzap/string_to_dummy_timeRafael Mendonça França2012-09-051-1/+7
|/ | | | | | Fix for time type columns with invalid time value Conflicts: activerecord/CHANGELOG.md
* Merge pull request #7388 from ↵Rafael Mendonça França2012-08-181-1/+1
|\ | | | | | | | | ManageIQ/fix_table_remove_passing_array_deprecation Table#remove passed an array to remove_column, which is deprecated.
| * Table#remove passed an array to remove_column, which is deprecated.Joe Rafaniello2012-08-181-1/+1
| | | | | | | | See 02ca9151a043a4fefbb3f22edd05f0cd392fffaa
* | Ruby 1.8 doesn't have to_r defined to NilClass and Float.Rafael Mendonça França2012-08-181-5/+14
|/ | | | Use round to get the right conversion
* Merge pull request #7352 from aripollak/microsecond-timestampRafael Mendonça França2012-08-171-2/+2
| | | | | | Fix occasional microsecond conversion inaccuracy Conflicts: activerecord/CHANGELOG.md
* Merge pull request #5872 from evtuhovich/prepared_statement_fixAaron Patterson2012-08-061-10/+10
| | | | | | Remove prepared statement from system query in postgresql adapter Conflicts: activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
* Backport #5168 to 3-2-stable. Fix a problem that NULLS is ignored by ↵kennyj2012-08-021-1/+1
| | | | postgresql_adapter.rb while creating distincts.
* Fixing texts; down to three failing tests.Jeremy Cole2012-07-132-15/+24
|
* 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
* Update psql adapter to rename a default pkey sequence during rename_table.Robb Kidd2012-07-101-0/+7
|
* Merge pull request #6985 from sidonath/disable-query-cache-for-locksRafael Mendonça França2012-07-061-1/+9
| | | | | | Disable query cache for lock queries Conflicts: activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
* Merge pull request #6878 from masarakki/masterRafael Mendonça França2012-06-281-0/+2
| | | | | | fix bug in limit of enum columns of mysql Closes #6432
* Merge pull request #6900 from cbandy/issue-6898Carlos Antonio da Silva2012-06-281-0/+2
| | | | | | Require URI in ConnectionSpecification Conflicts: activerecord/lib/active_record/connection_adapters/connection_specification.rb
* Fix GH #3163. Should quote database on mysql/mysql2.kennyj2012-06-111-1/+1
| | | | | | Conflicts: activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
* 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
* Merge pull request #5244 from fotos/myqsl2_wait_timeoutRafael Mendonça França2012-05-251-1/+1
| | | | Maximum wait_timeout on Windows is 2147483
* Synchronize the ConnectionPool#release method to avoid thread safety issues ↵Andrew Selder2012-05-231-10/+12
| | | | | | | | | | | | | | | | | | | | [#6464] Fixes #6464 Synchronize the contents of the release method in ConnectionPool due to errors when running in high concurrency environments. Detected invalid hash contents due to unsynchronized modifications with concurrent users org/jruby/RubyHash.java:1356:in `keys' /usr/local/rvm/gems/jruby-1.6.7@new_import/gems/activerecord-3.2.3/lib/a ctive_record/connection_adapters/abstract/connection_pool.rb:294:in `release' /usr/local/rvm/gems/jruby-1.6.7@new_import/gems/activerecord-3.2.3/lib/a ctive_record/connection_adapters/abstract/connection_pool.rb:282:in `checkin'
* Postgresql doesn't accept limits on binary (bytea) columns.Victor Costan2012-05-211-8/+19
|
* Merge pull request #6398 from pmahoney/threadsafe-connection-poolAaron Patterson2012-05-191-4/+8
| | | | Synchronize read and modification of @reserved_connections
* Stop showing deprecations for Ruby 1.8.7 with remove_columnCarlos Antonio da Silva2012-05-092-4/+6
| | | | | String is Enumerable in 1.8.7, which means that passing a String to remove_column was generating deprecation warnings during tests.
* Deprecate remove_column with array as an argumentPiotr Sarnacki2012-05-022-0/+13
|
* Be sure to correctly fetch PK name from MySQL even if the PK has some custom ↵Akira Matsuda2012-04-191-1/+1
| | | | | | | | | | | option Backports #5900 Conflicts: activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
* Merge pull request #5437 from kennyj/fix_5430Aaron Patterson2012-03-151-1/+1
| | | | Fix GH #5430. A Payload name for schema_search_path should be SCHEMA.
* ConnectionPool.checkout takes account of ruby using 'non-blocking condition ↵Jonathan Rochkind2012-03-131-9/+18
| | | | variables' in mutex ConditionVariables
* make sure connections returned after close are marked as in_useAaron Patterson2012-03-121-0/+16
|
* inline docs for clear_active_connections! no longer says it cleans dead ↵Jonathan Rochkind2012-03-121-3/+1
| | | | threads, it doesn't since 3.2.0
* make active_connection? return true only if there is an open connection in ↵Aaron Patterson2012-03-081-3/+4
| | | | use for the current thread. fixes #5330
* only log an error if there is a logger. fixes #5226Aaron Patterson2012-03-022-2/+2
| | | | | | Conflicts: activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
* revert setting NOT NULL constraints in add_timestampsXavier Noria2012-03-011-2/+2
| | | | | | | | | | | Commit 3dbedd2 added NOT NULL constraints both to table creation and modification. For creation the new default makes sense, but the generic situation for changing a table is that there exist records. Those records have no creation or modification timestamps, and in the general case you don't even know them, so when updating a table these constraints are not going to work. See a bug report for this use case in #3334.
* Fix type_to_sql with text and limit on mysql/mysql2. Fix GH #3931.kennyj2012-02-291-9/+20
|
* Revert "No need to pass options which is never used"Rafael Mendonça França2012-02-261-2/+2
| | | | | | | | | Options is needed for some Rails extensions to determine when referential integrity should be disabled This reverts commit bcb466c543451dce69403aaae047295758589d8e. Fixes #5052
* prepared statements can be disabledAaron Patterson2012-02-216-28/+53
|
* tag bind params with a bind param objectAaron Patterson2012-02-213-3/+3
|
* more ruby 2.0 respond_to? changesAaron Patterson2012-02-211-1/+1
|
* Merge pull request #5096 from lawso017/masterAaron Patterson2012-02-211-16/+36
| | | | Restoring ability to derive id/sequence from tables with nonstandard sequences for primary keys
* Handle nil in add_index :length option in MySQLPaul Sadauskas2012-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Our schema.rb is being generated with an `add_index` line similar to this: add_index "foo", ["foo", "bar"], :name => "xxx", :length => {"foo"=>8, "bar=>nil} This is the same as it was on Rails 3.1.3, however, now when that schema.rb is evaluated, its generating bad SQL in MySQL: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 1: CREATE UNIQUE INDEX `xxx` ON `foo` (`foo`(8), `bar`()) This commit adds a check for nil on the length attribute to prevent the empty parens from being output. Conflicts: activerecord/test/cases/migration/index_test.rb Signed-off-by: José Valim <jose.valim@gmail.com>
* Fix Issue #4819densya2032012-02-041-1/+1
| | | | | | 'uninitialized constant ActiveRecord::Deprecation in Rails3.2.1' Just a typo of 'ActiveSupport::...'
* Merge pull request #4809 from cfeist/feist-sqlite-binary-corruptionAaron Patterson2012-02-021-16/+1
| | | | Fix for SQLite binary data corrupter (to master branch)
* Merge pull request #4763 from kennyj/fix_4754Jon Leighton2012-01-311-1/+1
| | | | [MySQL] Fix GH #4754. Remove double-quote characters around PK when using sql_mode=ANSI_QUOTES
* query cache instrumentation should included the bindings in the payload ↵Xavier Noria2012-01-301-1/+1
| | | | [closes #4750]
* on and ON are type casted to a true boolean columnSantiago Pastorino2012-01-111-2/+2
|
* Document that index names are made up of all columns, not just the first.Jo Liss2011-12-291-9/+2
| | | | | | | | | | | index_name has been using the following expression "index_#{table_name}_on_#{Array.wrap(options[:column]) * '_and_'}" since at least 2006 (bc7f2315), and that's how they come out in my DB. Please check that this is correct before merging into master, perhaps I'm misunderstanding the section I changed.
* Should clear the primary keys cache alsoJon Leighton2011-12-161-0/+1
|
* Don't store defaults in the schema cacheJon Leighton2011-12-161-3/+2
|
* Defaults hash can go on the modelJon Leighton2011-12-161-14/+1
|
* Cache columns at the model level.Jon Leighton2011-12-161-9/+2
| | | | Allows two models to use the same table but have different primary keys.
* Revert naive O(1) table_exists? implementation.Jon Leighton2011-12-133-12/+15
| | | | | | | | | | It was a bad idea to rescue exceptions here. This can interfere with transaction rollbacks which seems to be the cause of current CI failure. Instead, each adapter should implement its own DB-specific O(1) implementation, and we fall back on the generic, slower, implementation otherwise.