From fcdf5552f5a07d90f39f0d4f6e100fb9f6dba822 Mon Sep 17 00:00:00 2001 From: lovasoa Date: Tue, 11 Jul 2023 08:26:42 +0200 Subject: [PATCH] improve existing examples for sqlpage 0.7.2 --- examples/master-detail-forms/edit_user.sql | 4 +--- examples/master-detail-forms/insert_address.sql | 4 ++-- examples/master-detail-forms/insert_user.sql | 4 ++-- examples/official-site/get_started.sql | 3 +-- examples/official-site/manual_setup.sql | 3 +-- examples/read-and-set-http-cookies/logout.sql | 2 +- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/examples/master-detail-forms/edit_user.sql b/examples/master-detail-forms/edit_user.sql index 94c8e58f..fa9d0caf 100644 --- a/examples/master-detail-forms/edit_user.sql +++ b/examples/master-detail-forms/edit_user.sql @@ -2,9 +2,7 @@ SELECT 'shell' AS component, 'User Management App' AS title, 'user' AS icon, '/' SELECT 'form' AS component, 'Edit user' AS title, - CASE WHEN $id IS NULL THEN 'insert_user.sql' - ELSE 'update_user.sql?id=' || $id - END AS action; + 'insert_user.sql' || COALESCE('?id=' || $id, '') AS action; SELECT 'First name' AS name, TRUE AS required, diff --git a/examples/master-detail-forms/insert_address.sql b/examples/master-detail-forms/insert_address.sql index 1bc3847e..9a49c050 100644 --- a/examples/master-detail-forms/insert_address.sql +++ b/examples/master-detail-forms/insert_address.sql @@ -1,4 +1,4 @@ INSERT INTO address (user_id, street, city, country) VALUES ($user_id, :Street, :City, :Country) RETURNING - 'http_header' AS component, - 'edit_user.sql?id=' || user_id AS location; \ No newline at end of file + 'redirect' AS component, + 'edit_user.sql?id=' || user_id AS link; \ No newline at end of file diff --git a/examples/master-detail-forms/insert_user.sql b/examples/master-detail-forms/insert_user.sql index c336bed6..0f12a0b1 100644 --- a/examples/master-detail-forms/insert_user.sql +++ b/examples/master-detail-forms/insert_user.sql @@ -1,5 +1,5 @@ INSERT INTO user (id, first_name, last_name, email) VALUES ($id, :"First name", :"Last name", :Email) ON CONFLICT (id) DO UPDATE SET first_name = excluded.first_name, last_name = excluded.last_name, email = excluded.email RETURNING - 'http_header' AS component, - 'edit_user.sql?id=' || id AS location; \ No newline at end of file + 'redirect' AS component, + 'edit_user.sql?id=' || id AS link; \ No newline at end of file diff --git a/examples/official-site/get_started.sql b/examples/official-site/get_started.sql index d28c8255..c4a989e5 100644 --- a/examples/official-site/get_started.sql +++ b/examples/official-site/get_started.sql @@ -1,2 +1 @@ -SELECT 'http_header' as component, - 'get started.sql' as location; \ No newline at end of file +SELECT 'redirect' as component, 'get started.sql' as link; \ No newline at end of file diff --git a/examples/official-site/manual_setup.sql b/examples/official-site/manual_setup.sql index d28c8255..c4a989e5 100644 --- a/examples/official-site/manual_setup.sql +++ b/examples/official-site/manual_setup.sql @@ -1,2 +1 @@ -SELECT 'http_header' as component, - 'get started.sql' as location; \ No newline at end of file +SELECT 'redirect' as component, 'get started.sql' as link; \ No newline at end of file diff --git a/examples/read-and-set-http-cookies/logout.sql b/examples/read-and-set-http-cookies/logout.sql index 3a92594b..98eba70e 100644 --- a/examples/read-and-set-http-cookies/logout.sql +++ b/examples/read-and-set-http-cookies/logout.sql @@ -3,4 +3,4 @@ SELECT 'cookie' as component, 'username' as name, TRUE as remove; -SELECT 'http_header' as component, 'index.sql' as Location; \ No newline at end of file +SELECT 'redirect' as component, 'index.sql' as link; \ No newline at end of file