aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/arel
Commit message (Collapse)AuthorAgeFilesLines
* Make `And` and `Case` into expression nodesKevin Deisz2019-01-241-0/+9
| | | | Allows aliasing, predications, ordering, and various other functions on `And` and `Case` nodes. This brings them in line with other nodes like `Binary` and `Unary`.
* Alias case nodesKevin Deisz2019-01-211-0/+10
| | | | When `Arel` was merged into `ActiveRecord` we lost the ability to alias case nodes. This adds it back.
* More exercise test cases for `not_between`Ryuta Kamizono2019-01-121-29/+82
| | | | | | And support endless ranges for `not_between` like as `between`. Follow up #34906.
* Support endless ranges in whereGreg Navis2019-01-111-0/+12
| | | | | | This commit adds support for endless ranges, e.g. (1..), that were added in Ruby 2.6. They're functionally equivalent to explicitly specifying Float::INFINITY as the end of the range.
* Arel: Implemented DB-aware NULL-safe comparison (#34451)Dmytro Shteflyuk2018-11-159-1/+354
| | | | | | | | | * Arel: Implemented DB-aware NULL-safe comparison * Fixed where clause inversion for NULL-safe comparison * Renaming "null_safe_eq" to "is_not_distinct_from", "null_safe_not_eq" to "is_distinct_from" [Dmytro Shteflyuk + Rafael Mendonça França]
* Emit single pair of parens for UNION and UNION ALLKeenan Brock2018-11-132-10/+22
| | | | | | | | mysql has a great implementation to suppress multiple parens for union sql statements. This moves that functionality to the generic implementation This also introduces that functionality for UNION ALL
* Handle DELETE with LIMIT in ArelRyuta Kamizono2018-09-301-0/+1
| | | | | | | | | | | | | | | | | | MySQL supports DELETE with LIMIT and ORDER BY. https://dev.mysql.com/doc/refman/8.0/en/delete.html Before: ``` Post Destroy (1.0ms) DELETE FROM `posts` WHERE `posts`.`id` IN (SELECT `id` FROM (SELECT `posts`.`id` FROM `posts` WHERE `posts`.`author_id` = ? ORDER BY `posts`.`id` ASC LIMIT ?) __active_record_temp) [["author_id", 1], ["LIMIT", 1]] ``` After: ``` Post Destroy (0.4ms) DELETE FROM `posts` WHERE `posts`.`author_id` = ? ORDER BY `posts`.`id` ASC LIMIT ? [["author_id", 1], ["LIMIT", 1]] ```
* `SQLString#compile` is no longer used since ↵Ryuta Kamizono2018-09-301-11/+5
| | | | 53521a9e39b9d8af4165d7703c36dc905f1f8f67
* Remove `visit_Fixnum` and `visit_Bignum`Ryuta Kamizono2018-09-301-1/+1
| | | | Follow up ae406cd633dab2cafbc0d1bb5922d1ca40056ea0.
* Abandon TOP support.Vladimir Kochnev2018-09-253-4/+2
| | | | | | | | | | | | | | | | Initially, `TOP` was introduced to support `limit` for MSSQL database. Unlike PostgreSQL/MySQL/SQLite, MSSQL does not have native `LIMIT`/`OFFSET` support. The commit adding `TOP` is 1a246f71616cf246a75ef6cbdb56032e43d4e643. However, it figured out that `TOP` implementation was weak and it's not sufficient to also support `OFFSET`, then `TOP` was substituted with `ROW_NUMBER()` subquery in be48ed3071fd6524d0145c4ad3faeb4aafe3eda3. This is a well known trick in MSSQL - https://stackoverflow.com/questions/2135418/equivalent-of-limit-and-offset-for-sql-server. So now we don't need this `visit_Arel_Nodes_Top` at all. It does nothing useful but also adds an extra space after `SELECT` when `LIMIT` is being used for **any** database.
* Fix a wrong correctionKazuhiro Sera2018-08-081-1/+1
|
* Fix the obvious typos detected by github.com/client9/misspellKazuhiro Sera2018-08-084-15/+15
|
* Enable `Layout/EmptyLinesAroundBlockBody` to reduce review cost in the futureRyuta Kamizono2018-07-122-13/+0
| | | | | | | We sometimes ask "✂️ extra blank lines" to a contributor in reviews like https://github.com/rails/rails/pull/33337#discussion_r201509738. It is preferable to deal automatically without depending on manpower.
* Fix: Arel Postgresql visitor generates invalid SQL for GROUPING SETS.david2018-05-281-3/+3
|
* Enable `Lint/StringConversionInInterpolation` rubocop ruleRyuta Kamizono2018-05-211-2/+2
| | | | | To prevent redundant `to_s` like https://github.com/rails/rails/pull/32923#discussion_r189460008 automatically in the future.
* Add math testsNikolai B2018-05-142-9/+83
| | | | | | After #449 was merged math can be done on these nodes, adding a test file to unit test all the math operators.
* Remove unused `assert_like` from `Arel::Test`Yasuo Honda2018-05-021-5/+0
| | | | | It had been added at https://github.com/rails/arel/commit/05b5bb12270b32e094c1c879273e0978dabe5b3b and removed at https://github.com/rails/arel/commit/db1bb4e9a728a437d16f8bdb48c3b772c3e4edb0
* Remove unnecessary requireyuuji.yaginuma2018-05-021-1/+0
| | | | `require 'rubygems'` is already required in Ruby 1.9 or later.
* `require "active_support/test_case"` is not supported since 53e877f7Ryuta Kamizono2018-05-021-1/+1
| | | | | | | It will cause "undefined method `test_order' for ActiveSupport:Module (NoMethodError)". https://travis-ci.org/rails/rails/jobs/373472604#L1208
* Make `Arel::Test` subclass of `ActiveSupport::TestCase`Yasuo Honda2018-05-018-73/+84
| | | | | | | | | | not `Minitest::Test` to address `CustomCops/RefuteNot` and `CustomCops/AssertNot` offenses for Arel test cases Also including `ActiveSupport::Testing::Assertions` to `Arel::Spec` and add test/unit backwards compatibility methods Fixes #32720
* Address `NameError: uninitialized constant Arel::Collectors::Bind`Yasuo Honda2018-04-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when tested with Ruby 2.5 or higher ```ruby $ ruby -v ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] $ bundle exec ruby -w -Itest test/cases/arel/collectors/bind_test.rb -n test_compile_gathers_all_bind_params Run options: -n test_compile_gathers_all_bind_params --seed 24420 E Error: Arel::Collectors::TestBind#test_compile_gathers_all_bind_params: NameError: uninitialized constant Arel::Collectors::Bind Did you mean? Binding test/cases/arel/collectors/bind_test.rb:15:in `collect' test/cases/arel/collectors/bind_test.rb:19:in `compile' test/cases/arel/collectors/bind_test.rb:31:in `test_compile_gathers_all_bind_params' bin/rails test test/cases/arel/collectors/bind_test.rb:30 Finished in 0.002343s, 426.8559 runs/s, 0.0000 assertions/s. 1 runs, 0 assertions, 0 failures, 1 errors, 0 skips $ ``` It is likely due to Ruby 2.5 does not look up top level constant. https://www.ruby-lang.org/en/news/2017/12/25/ruby-2-5-0-released/ "Top-level constant look-up is no longer available."
* Arel: rubocop -aMatthew Draper2018-02-2460-1218/+1263
|
* Merge Arel into Active RecordMatthew Draper2018-02-2460-0/+6722