@@ -1536,6 +1536,10 @@ $query = $cities->find()
15361536# WHERE name COLLATE LIKE Latin1_general_CI_AI "%São José%"
15371537```
15381538
1539+ Collation names must be simple ASCII names; whitespace and hyphens are
1540+ rejected with ` InvalidArgumentException ` . Choose collations from a fixed list
1541+ in application code instead of accepting arbitrary user input.
1542+
15391543### Automatically Creating IN Clauses
15401544
15411545When building queries using the ORM, you will generally not have to indicate the
@@ -2381,6 +2385,26 @@ by `AggregateExpresion`, but make sure you follow your database documentation on
23812385 the current row that should be included in the aggregate function. This
23822386 evaluates values based on the ` orderBy() ` field.
23832387
2388+ String arguments for window partitioning, ordering and frame boundaries must
2389+ be simple names or values. SQL fragments containing spaces or operators are
2390+ rejected with ` InvalidArgumentException ` . Use an expression object for a
2391+ trusted SQL fragment, for example an interval boundary:
2392+
2393+ ``` php
2394+ use Cake\Database\Expression\QueryExpression;
2395+ use Cake\Database\Expression\WindowExpression;
2396+
2397+ $window = (new WindowExpression())->range(
2398+ new QueryExpression("'1 day'"),
2399+ new QueryExpression("'10 days'"),
2400+ );
2401+ ```
2402+
2403+ Expression objects contain raw SQL. Construct these fragments from trusted
2404+ application code, never directly from request data. The same restriction on
2405+ simple names applies to function names passed to ` FunctionExpression ` and
2406+ ` AggregateExpression ` .
2407+
23842408If you need to re-use the same window expression multiple times you can create
23852409named windows using the ` window() ` method:
23862410
0 commit comments