|
1 | 1 | # CHANGELOG.md |
2 | 2 |
|
3 | 3 | ## unrelease |
| 4 | + - **Variable System Improvements**: URL and POST parameters are now immutable, preventing accidental modification. User-defined variables created with `SET` remain mutable. |
| 5 | + - **BREAKING**: `$variable` no longer accesses POST parameters. Use `:variable` instead. |
| 6 | + - **What changed**: Previously, `$x` would return a POST parameter value if no GET parameter named `x` existed. |
| 7 | + - **Fix**: Replace `$x` with `:x` when you need to access form field values. |
| 8 | + - **Example**: Change `SELECT $username` to `SELECT :username` when reading form submissions. |
| 9 | + - **BREAKING**: `SET $name` no longer overwrites GET (URL) parameters when a URL parameter with the same name exists. |
| 10 | + - **What changed**: `SET $name = 'value'` would previously overwrite the URL parameter `$name`. Now it creates an independent SET variable that shadows the URL parameter. |
| 11 | + - **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')`. |
| 12 | + - **Example**: If your URL is `page.sql?name=john`, and you do `SET $name = 'modified'`, then: |
| 13 | + - `$name` will be `'modified'` (the SET variable) |
| 14 | + - The original URL parameter is still preserved and accessible: |
| 15 | + - PostgreSQL: `sqlpage.variables('get')->>'name'` returns `'john'` |
| 16 | + - SQLite: `json_extract(sqlpage.variables('get'), '$.name')` returns `'john'` |
| 17 | + - MySQL: `JSON_UNQUOTE(JSON_EXTRACT(sqlpage.variables('get'), '$.name'))` returns `'john'` |
| 18 | + - **New behavior**: Variable lookup now follows this precedence: |
| 19 | + - `$variable` checks SET variables first, then URL parameters |
| 20 | + - `:variable` checks SET variables first, then POST parameters |
| 21 | + - SET variables always shadow URL/POST parameters with the same name |
| 22 | + - **New sqlpage.variables() filters**: |
| 23 | + - `sqlpage.variables('get')` returns only URL parameters as JSON |
| 24 | + - `sqlpage.variables('post')` returns only POST parameters as JSON |
| 25 | + - `sqlpage.variables('set')` returns only user-defined SET variables as JSON |
| 26 | + - `sqlpage.variables()` returns all variables merged together, with SET variables taking precedence |
| 27 | + - **Deprecation warnings**: Using `$var` when both a URL parameter and POST parameter exist with the same name now shows a warning. In a future version, you'll need to explicitly choose between `$var` (URL) and `:var` (POST). |
4 | 28 | - add support for postgres range types |
5 | 29 |
|
6 | 30 | ## v0.39.1 (2025-11-08) |
|
0 commit comments