-
- Add special handling of hidden inputs in [forms](https://sql.ophir.dev/documentation.sql?component=form#component). Hidden inputs are now completely invisible to the end user, facilitating the implementation of multi-step forms, csrf protaction, and…
released this
2023-11-19 20:26:08 +00:00 … other complex forms.
- 36 new icons available
- Support multiple statements in
on_connect.sqlin MySQL. - Randomize postgres prepared statement names to avoid name collisions. This should fix a bug where SQLPage would report errors like
prepared statement "sqlx_s_1" already existswhen using a connection pooler in front of a PostgreSQL database. It is still not recommended to use SQLPage with an external connection pooler (such as pgbouncer), because SQLPage already implements its own connection pool. If you really want to use a connection pooler, you should set themax_connectionsconfiguration parameter to1to disable the connection pooling logic in SQLPage. - SQL statements are now prepared lazily right before their first execution, instead of all at once when a file is first loaded, which allows referencing a temporary table created at the start of a file in a later statement in the same file. This works by delegating statement preparation to the database interface library we use (sqlx). The logic of preparing statements and caching them for later reuse is now entirely delegated to sqlx. This also nicely simplifies the code and logic inside sqlpage itself, and should slightly improve performance and memory usage.
- Creating temporary tables at the start of a file is a nice way to keep state between multiple statements in a single file, without having to use variables, which can contain only a single string value:
DROP VIEW IF EXISTS current_user; CREATE TEMPORARY VIEW current_user AS SELECT * FROM users INNER JOIN sessions ON sessions.user_id = users.id WHERE sessions.session_id = sqlpage.cookie('session_id'); SELECT 'card' as component, 'Welcome, ' || username as title FROM current_user;
- Creating temporary tables at the start of a file is a nice way to keep state between multiple statements in a single file, without having to use variables, which can contain only a single string value:
- Add support for resetting variables to a
NULLvalue usingSET. Previously, storingNULLin a variable would store the string'null'instead of theNULLvalue. This is now fixed.SET myvar = NULL; SELECT 'card' as component; SELECT $myvar IS NULL as title; -- this used to display false, it now displays true
Downloads