aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapter_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* remove_index do not fetch indexes if name is specifiedSeva Orlov2016-04-241-0/+11
| | | | | | There is no need to fetch all table indexes in remove_index if name is specified. If name is wrong, then StatementInvalid will be raised. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Merge pull request #23522 from kamipo/add_value_too_long_exception_classJeremy Daer2016-04-181-0/+9
|\ | | | | | | Add `ActiveRecord::ValueTooLong` exception class
| * Add `ActiveRecord::ValueTooLong` exception classRyuta Kamizono2016-02-061-0/+9
| |
* | Add a test case for create a record with primary key as zeroRyuta Kamizono2016-03-301-0/+6
| |
* | Fix tests failure with `prepared_statements: false`Ryuta Kamizono2016-02-291-1/+2
|/ | | | | | Some tests does not work for unprepared statements. Add `if ActiveRecord::Base.connection.prepared_statements` and fix a regex for fix tests failure with `prepared_statements: false`.
* Remove legacy mysql adapterAbdelkader Boudih2015-12-171-2/+2
|
* Deprecate `#table_exists?`, `#tables` and passing arguments to `#talbes`yui-knk2015-11-091-4/+21
| | | | | | | | | | Reported on #21509, how views is treated by `#tables` are differ by each adapters. To fix this different behavior, after Rails 5.0 is released, deprecate `#tables`. And `#table_exists?` would check both tables and views. To make their behavior consistent with `#tables`, after Rails 5.0 is released, deprecate `#table_exists?`.
* Deprecate exception#original_exception in favor of exception#causeYuki Nishijima2015-11-031-4/+12
|
* introduce `conn.data_source_exists?` and `conn.data_sources`.Yves Senn2015-09-221-0/+15
| | | | | | | | | | | | | | | | | These new methods are used from the Active Record model layer to determine which relations are viable to back a model. These new methods allow us to change `conn.tables` in the future to only return tables and no views. Same for `conn.table_exists?`. The goal is to provide the following introspection methods on the connection: * `tables` * `table_exists?` * `views` * `view_exists?` * `data_sources` (views + tables) * `data_source_exists?` (views + tables)
* Should test both mysql adaptersRyuta Kamizono2015-09-201-1/+1
| | | | | Some test cases are testing only mysql adapter. We should test mysql2 adapter also.
* Closes rails/rails#18864: Renaming transactional fixtures to transactional testsBrandon Weiss2015-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I’m renaming all instances of `use_transcational_fixtures` to `use_transactional_tests` and “transactional fixtures” to “transactional tests”. I’m deprecating `use_transactional_fixtures=`. So anyone who is explicitly setting this will get a warning telling them to use `use_transactional_tests=` instead. I’m maintaining backwards compatibility—both forms will work. `use_transactional_tests` will check to see if `use_transactional_fixtures` is set and use that, otherwise it will use itself. But because `use_transactional_tests` is a class attribute (created with `class_attribute`) this requires a little bit of hoop jumping. The writer method that `class_attribute` generates defines a new reader method that return the value being set. Which means we can’t set the default of `true` using `use_transactional_tests=` as was done previously because that won’t take into account anyone using `use_transactional_fixtures`. Instead I defined the reader method manually and it checks `use_transactional_fixtures`. If it was set then it should be used, otherwise it should return the default, which is `true`. If someone uses `use_transactional_tests=` then it will overwrite the backwards-compatible method with whatever they set.
* Remove Relation#bind_paramsSean Griffin2015-01-271-2/+2
| | | | | | | | `bound_attributes` is now used universally across the board, removing the need for the conversion layer. These changes are mostly mechanical, with the exception of the log subscriber. Additional, we had to implement `hash` on the attribute objects, so they could be used as a key for query caching.
* Don't test invalid log encoding against PostgreSQL adapterRafael Mendonça França2015-01-021-4/+6
| | | | It already treats the message
* Merge pull request #8547 from printercu/patch-1Rafael Mendonça França2015-01-021-0/+8
|\ | | | | | | | | | | | | | | fix for messages in invalid encoding from db-drivers Conflicts: activerecord/lib/active_record/connection_adapters/abstract_adapter.rb activerecord/test/cases/connection_adapters/abstract_adapter_test.rb
* | Add where condition so select_one returns the correct record.Zuhao Wan2014-07-281-1/+1
| |
* | Remove dead test code for unsupported adaptersSean Griffin2014-05-171-13/+9
| |
* | We can conditional define the tests depending on the adapter orRajarshi Das2014-04-021-7/+5
| | | | | | | | connection.
* | Add a test case for save(validate:false) with invalid foreign key.Lauro Caetano2014-03-271-1/+15
| | | | | | | | | | It is supposed to raise ActiveRecord::InvalidForeignKey when the database has a fk constraint.
* | Use teardown helper method.Guo Xiang Tan2014-03-141-1/+1
| | | | | | | | | | | | | | | | Follow-Up to https://github.com/rails/rails/pull/14348 Ensure that SQLCounter.clear_log is called after each test. This is a step to prevent side effects when running tests. This will allow us to run them in random order.
* | Fix regression on `.select_*` methods.Arthur Neves2014-01-301-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]
* | using symbol instead of string in establish_connectionKuldeep Aggarwal2013-12-251-1/+1
| |
* | Deprecate use of string in establish_connection as connection lookupJosé Valim2013-12-241-1/+1
|/
* `connection.type_to_sql` returns a `String` for unmapped types.Yves Senn2013-12-031-0/+4
| | | | | | | | | | Closes #13146. This fixes an error when using: ``` change_colum :table, :column, :bigint, array: true ```
* Don't skip tests if we don't need to.Rafael Mendonça França2013-11-081-15/+13
| | | | | | | We can conditional define the tests depending on the adapter or connection. Lets keep the skip for fail tests that need to be fixed.
* Defines the return type of select / select_all method.kennyj2013-07-231-0/+5
|
* Fixed typos in ActiveRecordPrathamesh Sonpatki2013-03-281-2/+2
|
* Changed update_record to use prepared statements.Noemj2013-02-111-0/+14
|
* Anonymous class is not allowed. For reference see #8934 and bc43763247e25Guillermo Iguaran2013-01-191-4/+6
|
* Remove ActiveRecord::ModelJon Leighton2012-10-261-3/+3
| | | | | | | | | | In the end I think the pain of implementing this seamlessly was not worth the gain provided. The intention was that it would allow plain ruby objects that might not live in your main application to be subclassed and have persistence mixed in. But I've decided that the benefit of doing that is not worth the amount of complexity that the implementation introduced.
* Ensure disconnecting or reconnecting resets the transaction stateJon Leighton2012-09-151-0/+32
|
* Fix CIJon Leighton2011-12-281-3/+3
|
* Revert naive O(1) table_exists? implementation.Jon Leighton2011-12-131-0/+1
| | | | | | | | | | 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.
* namespace the adapter testAaron Patterson2011-11-291-121/+123
|
* pushing caching and visitors down to the connectionAaron Patterson2011-11-191-10/+0
|
* Make it the responsibility of the connection to hold onto an ARel visitor ↵Jon Leighton2011-08-081-0/+10
| | | | for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
* Fixed test_disable_referential_integrity on OracleRaimonds Simanovskis2011-08-081-0/+3
| | | On Oracle disable_referential_integrity before execution of block will disable foreign key constraints and after block will enable them but when constraints are enabled then they are validated. Therefore created record with invalid foreign key should be deleted before enabling foreign key constraints.
* move around testsAaron Patterson2011-07-211-30/+0
|
* fix postgres connection url testTerence Lee2011-07-201-1/+1
|
* Added test for postgres connections as URL. Fixed query param parsing.Glenn Gillen2011-07-201-0/+13
|
* Provide database connection settings as a URL.Glenn Gillen2011-07-201-0/+11
|
* Create a test case for disable_referential_integrityGabriel Sobrinho2011-07-011-0/+14
|
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Fix adapter_test.rb to make no assumptions about the database nameJon Leighton2011-06-051-2/+7
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* herp derpricating add_limit_offset!Aaron Patterson2011-01-031-12/+0
|
* Fix test which prevents connection reset on failing and remove hardcoded ↵Master Lambaster2010-06-181-8/+7
| | | | | | | | connection [#4689 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Add parentheses to avoid warnings when running AR tests.Emilio Tagua2010-06-081-4/+4
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Fixed adapter tests not to assert LIMIT and OFFSET in SQL stringsRaimonds Simanovskis2010-06-041-13/+4
| | | | Fixed adapter test cases that were failing in oracle because the asserts were looking for the presence of offset and limit which are not available in oracle. Changed the tests to check that the sql injection is not present in the output so that the tests are database adapter agnostic.
* Revert "When creating database with rake, create schemas in ↵Michael Koziarski2010-04-091-6/+0
| | | | | | | | | | | | | schema_search_path if it doesn't exist." This reverts commit 6c2a0675f11a9b5b8e88ed7dbccd65cb51be8029. Reverting because it breaks the ability to run tests using a non-superuser. Conflicts: activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb activerecord/lib/active_record/railties/databases.rake
* When creating database with rake, create schemas in schema_search_path if it ↵Rizwan Reza2010-03-281-0/+6
| | | | doesn't exist.