272 Commits

Author SHA1 Message Date
lovasoa ad0fc2c981 Fix bug with variable assignment
CI / compile_and_lint (push) Has been cancelled
CI / test (mssql) (push) Has been cancelled
CI / test (mysql) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / windows_test (push) Has been cancelled
CI / docker_build (linux/amd64) (push) Has been cancelled
CI / docker_build (linux/arm/v7) (push) Has been cancelled
CI / docker_build (linux/arm64) (push) Has been cancelled
CI / docker_push (push) Has been cancelled
Create Release / Build sqlpage binaries (target/superoptimized/sqlpage, macos-latest) (push) Has been cancelled
Create Release / Build sqlpage binaries (target/superoptimized/sqlpage, ubuntu-20.04) (push) Has been cancelled
Create Release / Build sqlpage binaries (target/superoptimized/sqlpage.exe, windows-latest) (push) Has been cancelled
Create Release / Build AWS Lambda Serverless zip image (push) Has been cancelled
Create Release / Create Github Release (push) Has been cancelled
Create Release / Publish to crates.io (push) Has been cancelled
fixes #138
2023-11-22 20:36:40 +01:00
Ophir LOJKINE 23f834de71 null variables (#136)
* 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.
2023-11-19 20:09:18 +01:00
Ophir LOJKINE 563bc87959 delegate statement preparation to sqlx (#135)
* delegate statement preparation to sqlx

The logic of preparing statements and caching them for later reuse is now entirely delegated to the sql driver library (sqlx).
This simplifies the code and logic inside sqlpage itself.

 More importantly, statements are now prepared in a streaming fashion when a file is first loaded, instead of all at once, which allows referencing a temporary table created at the start of a file in a later statement in the same file.

 fixes #100

* remove temporary table usage

mssql does not have "create temp table"

* mssql permissions fix
2023-11-19 01:32:04 +01:00
lovasoa ee12d0cad7 support multiple statements in on_connect for MySQL
Fixes #132
2023-11-17 18:54:52 +01:00
lovasoa 17681fb672 add support for geojson in the map component
this adds support for new geometries, including polygons

Closes https://github.com/lovasoa/SQLpage/issues/119
2023-11-07 23:52:38 +01:00
lovasoa 7b6901373b cookie removal 2023-11-06 22:37:43 +01:00
lovasoa e22f5f4f8e cast parameters to VARCHAR(8000) on mssql 2023-11-06 22:35:17 +01:00
lovasoa 5905ed2fe3 use CAST(? as TEXT) to avoid data truncation 2023-11-05 10:49:22 +01:00
lovasoa cc2c7c1a09 Revert "remove unneeded generated sql casts"
This reverts commit 14b86acaa8.
2023-11-04 21:53:52 +01:00
lovasoa 5e56c85b3b Support non-string values in markdown fields
`NULL` values are now displayed as empty strings, numeric values are displayed as strings, booleans as `true` or `false`, and arrays as lines of text. This avoids the need to cast values to strings in SQL queries.
2023-11-01 01:24:17 +01:00
lovasoa 59779217a0 update sqlparser
fixes: MySQL's `REGEXP` binary operator is not supported #107

and answers https://github.com/lovasoa/SQLpage/discussions/109
2023-10-29 09:59:02 +01:00
lovasoa 65eaadc880 fmt 2023-10-26 20:14:06 +02:00
lovasoa 7597554e10 remove unneeded generated sql casts 2023-10-26 03:46:34 +02:00
lovasoa 2fc2ea8410 New function: sqlpage.path
fixes https://github.com/lovasoa/SQLpage/issues/114
2023-10-26 02:50:17 +02:00
ophir 17720bfcba new function: sqlpage.variables 2023-10-22 00:41:40 +02:00
lovasoa 72aa943ad7 carify error message provenance 2023-10-18 21:35:00 +02:00
lovasoa a698be20a4 small code style fixes 2023-10-16 01:00:36 +02:00
lovasoa 33fb14b947 better error logs on 404 2023-10-16 00:12:35 +02:00
lovasoa 1b5a19ca89 When NULL is passed as an icon name, display no icon instead of raising an error. 2023-10-16 00:12:03 +02:00
lovasoa 5c8c366021 fix error message on invalid header-only component usage
fixes https://github.com/lovasoa/SQLpage/discussions/101
2023-10-13 21:14:57 +02:00
lovasoa ab81583005 fix log level 2023-10-08 09:33:56 +02:00
lovasoa 09b66cb9f6 Improve migration formatting in logs 2023-10-08 09:33:56 +02:00
lovasoa 906b8d8a5e clippy 2023-10-08 09:33:56 +02:00
lovasoa c1b79b8aec Improve error messages on invalid migrations
Provide the user with the precise location of the error within the
migration file
2023-10-08 09:33:56 +02:00
lovasoa 9f525bda4a change sql error message 2023-10-08 09:33:56 +02:00
lovasoa 37bcc5be6d report precise syntax error position
SQL errors reported by the db were already handled correctly.
When sqlpage cannot parse a sql statement, it now reportes the precise error position too
2023-10-08 09:33:56 +02:00
lovasoa c812f421bb allow customization of empty lists 2023-10-04 12:01:18 +02:00
lovasoa 94758eb194 small code simplification 2023-10-03 12:53:47 +02:00
lovasoa 9ea59120fb create the config dir if it does not exist 2023-10-03 12:04:33 +02:00
lovasoa 87494ca4ff default db is now inaccessible by http by default
Create the default SQLite database file in the "sqlpage" config
directory instead of at the root of the web server by default.

see https://github.com/lovasoa/SQLpage/issues/94
2023-10-03 11:37:44 +02:00
lovasoa b2017fd5f0 clippy 2023-10-02 22:57:34 +02:00
lovasoa ffcf9c38d3 reformat 2023-10-02 18:11:17 +02:00
lovasoa 86053c00f2 Improve error messages
Include the error position and the text of the sql statement that failed
when possible
2023-10-02 18:09:57 +02:00
lovasoa b1669ea7c7 Split the database module 2023-10-02 17:08:43 +02:00
lovasoa 1ebe642500 Split out database connection init
Connection to the db and pooling config now in their own file
2023-10-02 16:49:58 +02:00
lovasoa 9a6c674138 Split out database migration code 2023-10-02 16:42:52 +02:00
lovasoa 7083e55453 improve migration error messages 2023-10-01 03:39:12 +02:00
lovasoa 61005382a6 remove confusing error message when a migration is invalid 2023-09-30 22:22:04 +02:00
lovasoa cf4c571ace connection initialization scripts
add the ability to create a `sqlpage/on_connect.sql` file that will be run every time a new database connection is opened.

This has many interesting applications, see configuration.md

See https://github.com/lovasoa/SQLpage/discussions/48
2023-09-30 02:29:19 +02:00
lovasoa 87a64f5d71 adapt to latest sqlparser 2023-09-29 21:33:54 +02:00
lovasoa 6e2cec577e fix handling of non-string variables
See https://github.com/lovasoa/SQLpage/discussions/73#discussioncomment-7127489
2023-09-28 10:00:35 +02:00
lovasoa 1a934b321e clippy 2023-09-27 20:39:09 +02:00
lovasoa a97bb4e5ac new sqlpage.url_encode() function 2023-09-27 20:30:35 +02:00
lovasoa 8ee57a08e5 new function: sqlpage.exec
This is a game changer and allows many new usecases that were previously impossible:

sending emails, querying external APIs, integrating with external providers, launching custom scripts, and much more.
2023-09-27 17:22:41 +02:00
lovasoa 659c32da72 new function: sqlpage.exec
allows launching external programs from sqlpage
2023-09-26 02:00:40 +02:00
lovasoa 53447324ad allow literals as parameters to hash_password 2023-09-24 21:53:26 +02:00
lovasoa 22b625db1a clippy 2023-09-24 20:03:00 +02:00
lovasoa ab9eefc0e0 Easier configuration for multiple menu items. Syntax like SELECT 'shell' as component, '["page 1", "page 2"]' as menu_item' now works as expected. 2023-09-24 19:03:22 +02:00
lovasoa 7d7b1631b5 asynchronous password hashing 2023-09-21 00:23:36 +02:00
lovasoa 9f6b812bae async sqlpage pseudo-function execution 2023-09-21 00:00:48 +02:00