forked from sqlpage/SQLPage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update dependencies * Add support for resetting variables to a `NULL` value using `SET`. Previously, storing `NULL` in a variable would store the string `'null'` instead of the `NULL` value.
- Loading branch information
Showing
9 changed files
with
51 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
SET username = (SELECT username FROM login_session WHERE id = sqlpage.cookie('session')); | ||
|
||
SELECT 'redirect' AS component, | ||
'signin.sql?error' AS link | ||
WHERE logged_in_user(sqlpage.cookie('session')) IS NULL; | ||
-- logged_in_user is a custom postgres function defined in the first migration of this example | ||
-- that avoids having to repeat `(SELECT username FROM login_session WHERE id = session_id)` everywhere. | ||
WHERE $username IS NULL; | ||
|
||
SELECT 'shell' AS component, 'Protected page' AS title, 'lock' AS icon, '/' AS link, 'logout' AS menu_item; | ||
|
||
SELECT 'text' AS component, | ||
'Welcome, ' || logged_in_user(sqlpage.cookie('session')) || ' !' AS title, | ||
'Welcome, ' || $username || ' !' AS title, | ||
'This content is [top secret](https://youtu.be/dQw4w9WgXcQ). | ||
You cannot view it if you are not connected.' AS contents_md; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set i_am_null = NULL; | ||
select 'text' as component, | ||
CASE | ||
WHEN $i_am_null IS NULL | ||
THEN | ||
'It works !' | ||
ELSE | ||
'error: expected null, got: ' || $i_am_null | ||
END as contents; |