Skip to content

Commit 32f133c

Browse files
committed
move more examples to sqlpage.link
1 parent 7ea28e2 commit 32f133c

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@
3232
select 'list' as component;
3333
select
3434
product_name as title,
35-
sqlpage.link('product.sql', json_object('product_id', product_id)) as link
35+
sqlpage.link('product.sql', json_object('product', product_name)) as link
3636
from products;
3737
```
38+
- Before, you would usually build the link manually with `CONCAT('/product.sql?product=', product_name)`, which would fail if the product name contained special characters like '&'. The new `sqlpage.link` function takes care of encoding the parameters correctly.
3839

3940
## 0.24.0 (2024-06-23)
4041
- in the form component, searchable `select` fields now support more than 50 options. They used to display only the first 50 options.

examples/CRUD - Authentication/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ SET $_username = (
2121
```sql
2222
SELECT
2323
'redirect' AS component,
24-
'/login.sql?path=' || $_curpath AS link
24+
sqlpage.link('/login.sql', json_object('path', $_curpath)) AS link
2525
WHERE $_username IS NULL AND $_session_required;
2626
```
2727
4. The login page renders the login form, accepts the user credentials, and redirects to create_session.sql, passing the login credentials as POST variables.

examples/CRUD - Authentication/www/create_session.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
SELECT
44
'authentication' AS component,
5-
'login.sql?' || ifnull('path=' || $path, '') || '&error=1' AS link,
5+
'login.sql?' || ifnull('path=' || sqlpage.url_encode($path), '') || '&error=1' AS link,
66
:password AS password,
77
(SELECT password_hash
88
FROM accounts

0 commit comments

Comments
 (0)