|
1 | 1 | # CHANGELOG.md |
2 | 2 |
|
3 | | -## unrelease |
| 3 | +## 0.40.0 (unreleased) |
4 | 4 | - **New Function**: `sqlpage.set_variable(name, value)` |
5 | 5 | - Returns a URL with the specified variable set to the given value, preserving other existing variables. |
6 | 6 | - This is a shorthand for `sqlpage.link(sqlpage.path(), json_patch(sqlpage.variables('get'), json_object(name, value)))`. |
|
9 | 9 | - **What changed**: Previously, `$x` would return a POST parameter value if no GET parameter named `x` existed. |
10 | 10 | - **Fix**: Replace `$x` with `:x` when you need to access form field values. |
11 | 11 | - **Example**: Change `SELECT $username` to `SELECT :username` when reading form submissions. |
12 | | - - **BREAKING**: `SET $name` no longer overwrites GET (URL) parameters when a URL parameter with the same name exists. |
| 12 | + - **BREAKING**: `SET $name` no longer makes GET (URL) parameters inaccessible when a URL parameter with the same name exists. |
13 | 13 | - **What changed**: `SET $name = 'value'` would previously overwrite the URL parameter `$name`. Now it creates an independent SET variable that shadows the URL parameter. |
14 | 14 | - **Fix**: This is generally the desired behavior. If you need to access the original URL parameter after setting a variable with the same name, extract it from the JSON returned by `sqlpage.variables('get')`. |
15 | 15 | - **Example**: If your URL is `page.sql?name=john`, and you do `SET $name = 'modified'`, then: |
16 | 16 | - `$name` will be `'modified'` (the SET variable) |
17 | 17 | - The original URL parameter is still preserved and accessible: |
18 | | - - PostgreSQL: `sqlpage.variables('get')->>'name'` returns `'john'` |
19 | | - - SQLite: `json_extract(sqlpage.variables('get'), '$.name')` returns `'john'` |
20 | | - - MySQL: `JSON_UNQUOTE(JSON_EXTRACT(sqlpage.variables('get'), '$.name'))` returns `'john'` |
| 18 | + - `sqlpage.variables('get')->>'name'` returns `'john'` |
21 | 19 | - **New behavior**: Variable lookup now follows this precedence: |
22 | 20 | - `$variable` checks SET variables first, then URL parameters |
23 | 21 | - `:variable` checks SET variables first, then POST parameters |
|
0 commit comments