You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added options to ignore order by in deletes and updates (#89)
* Added an option to ignore order by in deletes
* Enable test only when integration tests are executed
* Fix code styling
* Apply suggestions from code review
Co-authored-by: adityamish <89900889+adityamish@users.noreply.github.com>
* Added clarification according to the review
---------
Co-authored-by: AdalbertMemSQL <AdalbertMemSQL@users.noreply.github.com>
Co-authored-by: adityamish <89900889+adityamish@users.noreply.github.com>
@@ -20,6 +32,40 @@ public function compileOptions(array $options): string
20
32
return"OPTION ({$optionString})";
21
33
}
22
34
35
+
publicfunctioncompileDelete(Builder$query)
36
+
{
37
+
// TODO: allow order by in the case when table has unique column
38
+
if (isset($query->orders)) {
39
+
if ($this->ignoreOrderByInDeletes) {
40
+
if (env('APP_ENV') !== 'production') {
41
+
Log::warning('SingleStore does not support the "ORDER BY" clause in a "DELETE" statement. The "ORDER BY" clause will be ignored.');
42
+
}
43
+
$query->orders = [];
44
+
} else {
45
+
thrownewException('SingleStore does not support the "ORDER BY" clause in a "DELETE" statement. Enable the "ignore_order_by_in_deletes" configuration to ignore "orderBy" in "delete" operations.');
// TODO: allow order by in the case when table has unique column
55
+
if (isset($query->orders)) {
56
+
if ($this->ignoreOrderByInUpdates) {
57
+
if (env('APP_ENV') !== 'production') {
58
+
Log::warning('SingleStore does not support the "ORDER BY" clause in an "UPDATE" statement. The "ORDER BY" clause will be ignored.');
59
+
}
60
+
$query->orders = [];
61
+
} else {
62
+
thrownewException('SingleStore does not support the "ORDER BY" clause in an update statement. Enable the "ignore_order_by_in_updates" configuration to ignore "orderBy" in "update" operations.');
0 commit comments