Skip to content

Commit 544771d

Browse files
committed
v0.40
1 parent 7a65f88 commit 544771d

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CHANGELOG.md
22

3-
## unrelease
3+
## 0.40.0 (unreleased)
44
- **New Function**: `sqlpage.set_variable(name, value)`
55
- Returns a URL with the specified variable set to the given value, preserving other existing variables.
66
- This is a shorthand for `sqlpage.link(sqlpage.path(), json_patch(sqlpage.variables('get'), json_object(name, value)))`.
@@ -9,15 +9,13 @@
99
- **What changed**: Previously, `$x` would return a POST parameter value if no GET parameter named `x` existed.
1010
- **Fix**: Replace `$x` with `:x` when you need to access form field values.
1111
- **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.
1313
- **What changed**: `SET $name = 'value'` would previously overwrite the URL parameter `$name`. Now it creates an independent SET variable that shadows the URL parameter.
1414
- **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')`.
1515
- **Example**: If your URL is `page.sql?name=john`, and you do `SET $name = 'modified'`, then:
1616
- `$name` will be `'modified'` (the SET variable)
1717
- 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'`
2119
- **New behavior**: Variable lookup now follows this precedence:
2220
- `$variable` checks SET variables first, then URL parameters
2321
- `:variable` checks SET variables first, then POST parameters

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sqlpage"
3-
version = "0.39.1"
3+
version = "0.40.0"
44
edition = "2021"
55
description = "Build data user interfaces entirely in SQL. A web server that takes .sql files and formats the query result using pre-made configurable professional-looking components."
66
keywords = ["web", "sql", "framework"]

0 commit comments

Comments
 (0)