- 01 4月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
This partly reverts #35617. #35617 includes unused code (for `InsertStatement`) and re-using query annotation for `update_all` and `delete_all`, which has not been discussed yet. If a relation has any annotation, I think it is mostly for SELECT query, so re-using annotation by default is not always desired behavior for me. We should discuss about desired behavior before publishing the implementation.
-
- 22 3月, 2019 1 次提交
-
-
由 Matt Yoho 提交于
This patch has two main portions: 1. Add SQL comment support to Arel via Arel::Nodes::Comment. 2. Implement a Relation#annotate method on top of that. == Adding SQL comment support Adds a new Arel::Nodes::Comment node that represents an optional SQL comment and teachers the relevant visitors how to handle it. Comment nodes may be added to the basic CRUD statement nodes and set through any of the four (Select|Insert|Update|Delete)Manager objects. For example: manager = Arel::UpdateManager.new manager.table table manager.comment("annotation") manager.to_sql # UPDATE "users" /* annotation */ This new node type will be used by ActiveRecord::Relation to enable query annotation via SQL comments. == Implementing the Relation#annotate method Implements `ActiveRecord::Relation#annotate`, which accepts a comment string that will be appeneded to any queries generated by the relation. Some examples: relation = Post.where(id: 123).annotate("metadata string") relation.first # SELECT "posts".* FROM "posts" WHERE "posts"."id" = 123 # LIMIT 1 /* metadata string */ class Tag < ActiveRecord::Base scope :foo_annotated, -> { annotate("foo") } end Tag.foo_annotated.annotate("bar").first # SELECT "tags".* FROM "tags" LIMIT 1 /* foo */ /* bar */ Also wires up the plumbing so this works with `#update_all` and `#delete_all` as well. This feature is useful for instrumentation and general analysis of queries generated at runtime.
-
- 18 3月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
That is completely covered by `Arel::Nodes::ValuesList`. Related https://github.com/rails/arel/pull/484.
-
- 25 1月, 2019 1 次提交
-
-
由 Kevin Deisz 提交于
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`.
-
- 21 1月, 2019 1 次提交
-
-
由 Kevin Deisz 提交于
When `Arel` was merged into `ActiveRecord` we lost the ability to alias case nodes. This adds it back.
-
- 12 1月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
And support endless ranges for `not_between` like as `between`. Follow up #34906.
-
- 11 1月, 2019 1 次提交
-
-
由 Greg Navis 提交于
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.
-
- 16 11月, 2018 1 次提交
-
-
由 Dmytro Shteflyuk 提交于
* 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]
-
- 14 11月, 2018 1 次提交
-
-
由 Keenan Brock 提交于
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
-
- 30 9月, 2018 3 次提交
-
-
由 Ryuta Kamizono 提交于
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]] ```
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
Follow up ae406cd6.
-
- 25 9月, 2018 1 次提交
-
-
由 Vladimir Kochnev 提交于
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 1a246f71. 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 be48ed30. 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.
-
- 08 8月, 2018 2 次提交
-
-
由 Kazuhiro Sera 提交于
-
由 Kazuhiro Sera 提交于
-
- 12 7月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
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.
-
- 28 5月, 2018 1 次提交
-
-
由 david 提交于
-
- 21 5月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
To prevent redundant `to_s` like https://github.com/rails/rails/pull/32923#discussion_r189460008 automatically in the future.
-
- 15 5月, 2018 1 次提交
-
-
由 Nikolai B 提交于
After #449 was merged math can be done on these nodes, adding a test file to unit test all the math operators.
-
- 02 5月, 2018 3 次提交
-
-
由 Yasuo Honda 提交于
It had been added at https://github.com/rails/arel/commit/05b5bb12270b32e094c1c879273e0978dabe5b3b and removed at https://github.com/rails/arel/commit/db1bb4e9a728a437d16f8bdb48c3b772c3e4edb0
-
由 yuuji.yaginuma 提交于
`require 'rubygems'` is already required in Ruby 1.9 or later.
-
由 Ryuta Kamizono 提交于
It will cause "undefined method `test_order' for ActiveSupport:Module (NoMethodError)". https://travis-ci.org/rails/rails/jobs/373472604#L1208
-
- 01 5月, 2018 1 次提交
-
-
由 Yasuo Honda 提交于
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
-
- 25 4月, 2018 1 次提交
-
-
由 Yasuo Honda 提交于
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."
-
- 24 2月, 2018 1 次提交
-
-
由 Matthew Draper 提交于
-