- 19 3月, 2019 1 次提交
-
-
由 Jeremy Evans 提交于
roflscaling (using frozen string constants instead of literal strings) was added in 2012, before frozen string literals were added in Ruby 2.3. Now that Rails no longer supports Ruby <2.3, and all of these files use frozen string literals, there is no reason to keep the roflscaling. This does not delete or deprecate the related constants. Such a change can be made in a later commit.
-
- 18 3月, 2019 2 次提交
-
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
That is completely covered by `Arel::Nodes::ValuesList`. Related https://github.com/rails/arel/pull/484.
-
- 16 3月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
We as Arm Treasure Data are using Optimizer Hints with a monkey patch (https://gist.github.com/kamipo/4c8539f0ce4acf85075cf5a6b0d9712e), especially in order to use `MAX_EXECUTION_TIME` (refer #31129). Example: ```ruby class Job < ApplicationRecord default_scope { optimizer_hints("MAX_EXECUTION_TIME(50000) NO_INDEX_MERGE(jobs)") } end ``` Optimizer Hints is supported not only for MySQL but also for most databases (PostgreSQL on RDS, Oracle, SQL Server, etc), it is really helpful to turn heavy queries for large scale applications.
-
- 18 1月, 2019 2 次提交
-
-
由 Ryuta Kamizono 提交于
Currently several queries cannot return correct result due to incorrect `RangeError` handling. First example: ```ruby assert_equal true, Topic.where(id: [1, 9223372036854775808]).exists? assert_equal true, Topic.where.not(id: 9223372036854775808).exists? ``` The first example is obviously to be true, but currently it returns false. Second example: ```ruby assert_equal topics(:first), Topic.where(id: 1..9223372036854775808).find(1) ``` The second example also should return the object, but currently it raises `RecordNotFound`. It can be seen from the examples, the queries including large number assuming empty result is not always correct. Therefore, This change handles `RangeError` to generate executable SQL instead of raising `RangeError` to users to always return correct result. By this change, it is no longer raised `RangeError` to users.
-
由 Ryuta Kamizono 提交于
The `unboundable?` behaves like the `infinite?`. ```ruby inf = Topic.predicate_builder.build_bind_attribute(:id, Float::INFINITY) inf.infinite? # => 1 oob = Topic.predicate_builder.build_bind_attribute(:id, 9999999999999999999999999999999) oob.unboundable? # => 1 inf = Topic.predicate_builder.build_bind_attribute(:id, -Float::INFINITY) inf.infinite? # => -1 oob = Topic.predicate_builder.build_bind_attribute(:id, -9999999999999999999999999999999) oob.unboundable? # => -1 ```
-
- 09 1月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
* Enable `Lint/UselessAssignment` cop to avoid unused variable warnings Since we've addressed the warning "assigned but unused variable" frequently. 370537de 3040446c 5ed618e1 76ebafe5 And also, I've found the unused args in c1b14ade which raises no warnings by the cop, it shows the value of the cop.
-
- 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
-
- 03 11月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
-
- 10 10月, 2018 3 次提交
-
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
Before: ``` Pet Destroy (0.8ms) DELETE FROM `pets` WHERE `pets`.`pet_id` IN (SELECT `pet_id` FROM (SELECT DISTINCT `pets`.`pet_id` FROM `pets` LEFT OUTER JOIN `toys` ON `toys`.`pet_id` = `pets`.`pet_id` WHERE `toys`.`name` = ?) AS __active_record_temp) [["name", "Bone"]] ``` After: ``` Pet Destroy (1.0ms) DELETE `pets` FROM `pets` LEFT OUTER JOIN `toys` ON `toys`.`pet_id` = `pets`.`pet_id` WHERE `toys`.`name` = ? [["name", "Bone"]] ```
-
- 05 10月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
-
- 03 10月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
-
- 01 10月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
-
- 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.
-
- 28 9月, 2018 3 次提交
-
-
由 Ryuta Kamizono 提交于
Since Ruby 2.4 unified Fixnum and Bignum into Integer.
-
由 Ryuta Kamizono 提交于
Before: ``` Topic Update All (0.4ms) UPDATE `topics` SET `topics`.`replies_count` = COALESCE(`topics`.`replies_count`, 0) + 1, `topics`.`updated_at` = '2018-09-27 18:34:05.068774' WHERE `topics`.`id` = ? [["id", 7]] ``` After: ``` Topic Update All (0.4ms) UPDATE `topics` SET `topics`.`replies_count` = COALESCE(`topics`.`replies_count`, 0) + ?, `topics`.`updated_at` = ? WHERE `topics`.`id` = ? [["replies_count", 1], ["updated_at", 2018-09-27 18:55:05 UTC], ["id", 7]] ```
-
由 Ryuta Kamizono 提交于
Before: ``` Pet Update All (0.8ms) UPDATE `pets` LEFT OUTER JOIN `toys` ON `toys`.`pet_id` = `pets`.`pet_id` SET `pets`.`name` = 'Bob' WHERE `toys`.`name` = ? [["name", "Bone"]] ``` After: ``` Pet Update All (1.1ms) UPDATE `pets` LEFT OUTER JOIN `toys` ON `toys`.`pet_id` = `pets`.`pet_id` SET `pets`.`name` = ? WHERE `toys`.`name` = ? [["name", "Bob"], ["name", "Bone"]] ```
-
- 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.
-
- 09 9月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
-
- 28 5月, 2018 1 次提交
-
-
由 david 提交于
-
- 24 2月, 2018 2 次提交
-
-
由 Matthew Draper 提交于
-
由 Matthew Draper 提交于
-