You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Cargo.toml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
[package]
2
2
name = "sqlpage"
3
-
version = "0.6.12"
3
+
version = "0.7.0"
4
4
edition = "2021"
5
5
description = "A SQL-only web application framework. Takes .sql files and formats the query result using pre-made configurable professional-looking components."
-- Insert the http_header component into the component table
2
+
INSERT INTO component (name, description, icon)
3
+
VALUES (
4
+
'cookie',
5
+
'Sets a cookie in the client browser, used for session management and storing user-related information.
6
+
7
+
This component creates a single cookie. Since cookies need to be set before the response body is sent to the client,
8
+
this component should be placed at the top of the page, before any other components that generate output.
9
+
10
+
After being set, a cookie can be accessed anywhere in your SQL code using the `sqlpage.cookie(''cookie_name'')` pseudo-function.',
11
+
'cookie'
12
+
);
13
+
-- Insert the parameters for the http_header component into the parameter table
14
+
INSERT INTO parameter (
15
+
component,
16
+
name,
17
+
description,
18
+
type,
19
+
top_level,
20
+
optional
21
+
)
22
+
VALUES (
23
+
'cookie',
24
+
'name',
25
+
'The name of the cookie to set.',
26
+
'TEXT',
27
+
TRUE,
28
+
FALSE
29
+
),
30
+
(
31
+
'cookie',
32
+
'value',
33
+
'The value of the cookie to set.',
34
+
'TEXT',
35
+
TRUE,
36
+
TRUE
37
+
),
38
+
(
39
+
'cookie',
40
+
'path',
41
+
'The path for which the cookie will be sent. If not specified, the cookie will be sent for all paths.',
42
+
'TEXT',
43
+
TRUE,
44
+
TRUE
45
+
),
46
+
(
47
+
'cookie',
48
+
'domain',
49
+
'The domain for which the cookie will be sent. If not specified, the cookie will be sent for all domains.',
50
+
'TEXT',
51
+
TRUE,
52
+
TRUE
53
+
),
54
+
(
55
+
'cookie',
56
+
'secure',
57
+
'Whether the cookie should only be sent over a secure (HTTPS) connection. If not specified, the cookie will be sent over both secure and non-secure connections.',
58
+
'BOOLEAN',
59
+
TRUE,
60
+
TRUE
61
+
),
62
+
(
63
+
'cookie',
64
+
'http_only',
65
+
'Whether the cookie should only be accessible via HTTP and not via client-side scripts. If not specified, the cookie will be accessible via both HTTP and client-side scripts.',
66
+
'BOOLEAN',
67
+
TRUE,
68
+
TRUE
69
+
),
70
+
(
71
+
'cookie',
72
+
'remove',
73
+
'Set to TRUE to remove the cookie from the client browser. When specified, other parameters are ignored.',
74
+
'BOOLEAN',
75
+
TRUE,
76
+
TRUE
77
+
)
78
+
;
79
+
-- Insert an example usage of the http_header component into the example table
80
+
INSERT INTO example (component, description, properties)
81
+
VALUES (
82
+
'cookie',
83
+
'Create a cookie named `username` with the value `John Doe`...
84
+
85
+
```sql
86
+
SELECT ''cookie'' as component,
87
+
''username'' as name,
88
+
''John Doe'' as value;
89
+
```
90
+
91
+
and then display the value of the cookie:
92
+
93
+
```sql
94
+
SELECT ''text'' as component,
95
+
''Your name is '' || COALESCE(sqlpage.cookie(''username''), ''not known to us'');
0 commit comments