aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* Moves column dump specific code to a module included in AbstractAdapterDan McClain2012-09-147-15/+287
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having column related schema dumper code in the AbstractAdapter. The code remains the same, but by placing it in the AbstractAdapter, we can then overwrite it with Adapter specific methods that will help with Adapter specific data types. The goal of moving this code here is to create a new migration key for PostgreSQL's array type. Since any datatype can be an array, the goal is to have ':array => true' as a migration option, turning the datatype into an array. I've implemented this in postgres_ext, the syntax is shown here: https://github.com/dockyard/postgres_ext#arrays Adds array migration support Adds array_test.rb outlining the test cases for array data type Adds pg_array_parser to Gemfile for testing Adds pg_array_parser to postgresql_adapter (unused in this commit) Adds schema dump support for arrays Adds postgres array type casting support Updates changelog, adds note for inet and cidr support, which I forgot to add before Removing debugger, Adds pg_array_parser to JRuby platform Removes pg_array_parser requirement, creates ArrayParser module used by PostgreSQLAdapter
* update ConnectionAdaptar::Column#type_cast_code to be compatible with 3.2 branchThiago Pradi2012-09-131-1/+1
|
* Merge pull request #7521 from graceliu/fix_database_url_supportRafael Mendonça França2012-09-121-1/+1
|\ | | | | Fixed support for DATABASE_URL for rake db tasks
| * fixed support for DATABASE_URL for rake db tasksGrace Liu2012-09-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | - added tests to confirm establish_connection uses DATABASE_URL and Rails.env correctly even when no arguments are passed in. - updated rake db tasks to support DATABASE_URL, and added tests to confirm correct behavior for these rake tasks. (Removed establish_connection call from some tasks since in those cases the :environment task already made sure the function would be called) - updated Resolver so that when it resolves the database url, it removes hash values with empty strings from the config spec (e.g. to support connection to postgresql when no username is specified).
* | warning removed.Arun Agrawal2012-09-121-1/+0
|/ | | | | 1. Unused variable 2. possibly useless use of a variable in void context
* ConnectionPool, unify exceptions, ConnectionTimeoutErrorJonathan Rochkind2012-09-111-17/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a result of different commits, ConnectionPool had become of two minds about exceptions, sometimes using PoolFullError and sometimes using ConnectionTimeoutError. In fact, it was using ConnectionTimeoutError internally, but then recueing and re-raising as a PoolFullError. There's no reason for this bifurcation, standardize on ConnectionTimeoutError, which is the rails2 name and still accurately describes semantics at this point. History In Rails2, ConnectionPool raises a ConnectionTimeoutError if it can't get a connection within timeout. Originally in master/rails3, @tenderlove had planned on removing wait/blocking in connectionpool entirely, at that point he changed exception to PoolFullError. But then later wait/blocking came back, but exception remained PoolFullError. Then in 02b233556377 pmahoney introduced fair waiting logic, and brought back ConnectionTimeoutError, introducing the weird bifurcation. ConnectionTimeoutError accurately describes semantics as of this point, and is backwards compat with rails2, there's no reason for PoolFullError to be introduced, and no reason for two different exception types to be used internally, no reason to rescue one and re-raise as another. Unify!
* Remove expired comment. This method is used from other place.kennyj2012-09-111-2/+0
|
* indent fix [ci skip]Vijay Dev2012-09-091-1/+1
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-09-091-1/+1
|\ | | | | | | | | Conflicts: activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
| * Fix a typoAndreas Loupasakis2012-09-061-1/+1
| |
| * Fix indenentation in comment to stop the end of comment from appearing in a ↵Anuj Dutta2012-09-031-1/+1
| | | | | | | | <pre> block.
* | Merge pull request #7545 from senny/7518_postgres_type_detectionAaron Patterson2012-09-071-1/+1
|\ \ | | | | | | postgres, map scaled intervals to string datatype
| * | postgres, map scaled intervals to string datatype (#7518)Yves Senn2012-09-061-1/+1
| | |
* | | create a transaction object and point AR objects at that object during aAaron Patterson2012-09-072-6/+25
|/ / | | | | | | transaction.
* | ActiveRecord support to PostgreSQL 9.2 JSON typeDickson S. Guedes2012-09-055-3/+44
| | | | | | | | | | | | | | | | | | This implements the support to encode/decode JSON data to/from database and creating columns of type JSON using a native type [1] supported by PostgreSQL from version 9.2. [1] http://www.postgresql.org/docs/9.2/static/datatype-json.html
* | 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
| * | Fix for time type columns with invalid timeAdam Meehan2012-09-051-1/+7
| |/ | | | | | | | | | | The string_to_dummy_time method was blindly parsing the dummy time string with Date._parse which returns a hash for the date part regardless of whether the time part is an invalid time string.
* / Modularize postgresql adapterKonstantin Shabanov2012-09-056-985/+1038
|/
* Cache the connection pool for a given classJon Leighton2012-08-311-20/+35
|
* One hash is enoughJon Leighton2012-08-311-17/+13
| | | | We don't need separate @class_to_pool and @connection_pool hashes.
* Refactor connection handlerJon Leighton2012-08-311-22/+14
|
* 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.