Commit Graph

2623 Commits

Author SHA1 Message Date
lovasoa a8a59a97e2 WIP: Add ExecutionContext to separate mutable state from RequestInfo
This is a draft refactoring to avoid cloning large immutable data (headers,
cookies, body) when creating nested execution contexts in run_sql().

Changes:
- RequestInfo now contains only immutable request data
- ExecutionContext wraps Rc<RequestInfo> + mutable execution state
- Avoids cloning potentially large strings in nested run_sql() calls

Status: NOT COMPILING YET - this is work in progress
2025-11-19 02:31:14 +01:00
lovasoa 210fe0d8c0 Revert "Simplify run_sql: always use clone_without_variables"
This reverts commit 60f5a05446.
2025-11-19 02:20:16 +01:00
lovasoa 60f5a05446 Simplify run_sql: always use clone_without_variables
No need to branch on whether variables are provided since we clone in both cases anyway.
2025-11-19 02:19:49 +01:00
lovasoa e9458862c6 Restore deprecation warnings for $var accessing POST variables
- Warn when both URL and POST have same variable name
- Warn when $var is used for POST-only variable (should use :var)
2025-11-19 02:18:50 +01:00
lovasoa 610ce9f5de Restore deprecation warning for SET on POST variable names 2025-11-19 02:15:35 +01:00
lovasoa d69b1d1d9f Make URL and POST parameters immutable, separate from SET variables
- URL and POST parameters are now immutable after request initialization
- SET command creates user-defined variables in separate namespace
- Variable lookup: SET variables shadow request parameters
- Added sqlpage.variables('set') to inspect user-defined variables
- Simplified API: most functions now use &RequestInfo instead of &mut
- All tests passing (151 total)
2025-11-19 02:11:03 +01:00
Ophir LOJKINE 7cbf5034d8 Improve run_sql error messages (#1105)
* Refactor: Improve run_sql variable parsing

Co-authored-by: contact <contact@ophir.dev>

* Refactor: Use serde_path_to_error for better error reporting

Co-authored-by: contact <contact@ophir.dev>

* Remove serde_path_to_error, use serde_json error reporting

Co-authored-by: contact <contact@ophir.dev>

* Refactor: Move SingleOrVec tests to end of file

Co-authored-by: contact <contact@ophir.dev>

* fix SingleOrVec serialization

* Refactor: Move SingleOrVec to a dedicated module and update imports

* Move SingleOrVec tests from http.rs to single_or_vec.rs for better organization

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-11-19 01:52:38 +01:00
lovasoa 3276b5a786 Add a visual identity page to the website 2025-11-13 12:12:13 +01:00
Ophir LOJKINE f2c8164fee Test postgresql range type decoding (#1097)
* Add support for PostgreSQL range types in SQL to JSON conversion

Co-authored-by: contact <contact@ophir.dev>

* add support for postgres range types

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-11-12 18:05:44 +01:00
lovasoa 8498b76e5f update deps 2025-11-12 10:34:04 +01:00
Phoenix79-spec f4dab9ff1c Suppressed clippy redundant else error in http.rs using expect syntax. (#1096) 2025-11-12 02:44:44 +01:00
lovasoa d8e6a280fc Update CI configuration to use a shared cache key for Rust builds and adjust cache saving conditions. The shared key is now set to 'rust-sqlpage-proj-test' for both main and test branches, with the test branch cache saving disabled. 2025-11-08 01:25:39 +01:00
lovasoa e8ba8f7f1a Update CHANGELOG for v0.39.1 release, adding release date and summarizing key changes including improved server timing tracking and enhanced error messages.
Create Release / Build sqlpage binaries (macOS & Windows) (.exe, , windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Create Release / Build sqlpage binaries (macOS & Windows) (odbc-static, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
CI / compile_and_lint (push) Has been cancelled
CI / test (mssql, mssql, mssql://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
CI / test (mysql, mysql, mysql://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
CI / test (postgres, odbc, Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!, true) (push) Has been cancelled
CI / test (postgres, postgres, postgres://root:Password123!@127.0.0.1/sqlpage) (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 (Linux) (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
v0.39.1
2025-11-08 00:42:41 +01:00
lovasoa faa87ed9a8 sqlx 50 2025-11-08 00:40:34 +01:00
lovasoa 6bac53732d changelog 2025-11-08 00:34:40 +01:00
Ophir LOJKINE 97c2e4a0ed wip: perf guide (#1077)
* wip: perf guide

* update guide

* Add materialized views section to performance guide

- Introduced a new section on materialized views, explaining their purpose and benefits for optimizing analytical queries.
- Added an example SQL statement for creating a materialized view to compute total sales per store.
- Provided guidance on refreshing materialized views manually or via external scripts.

* Document nginx streaming and compression for sqlpage (#1080)

* Docs: Add Nginx streaming and compression configuration

Co-authored-by: contact <contact@ophir.dev>

* Add NGINX streaming and compression configuration

Co-authored-by: contact <contact@ophir.dev>

* Refactor NGINX proxy settings documentation for clarity

Co-authored-by: contact <contact@ophir.dev>

* Refine NGINX proxy buffering recommendations for streaming

Co-authored-by: contact <contact@ophir.dev>

* Update NGINX proxy buffering settings for improved streaming performance

Revised the documentation to clarify the impact of enabling and disabling proxy buffering in NGINX for SQLPage. Added concise recommendations for handling slow SQL queries and emphasized the importance of adjusting `compress_responses` in `sqlpage.json` when using a reverse proxy.

Co-authored-by: contact <contact@ophir.dev>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* Update dependencies and version for sqlpage to 0.39.1

- Bump versions of several dependencies including `aho-corasick`, `cc`, `clap`, `icu_collections`, and others to their latest releases.
- Update `Cargo.toml` to reflect the new version of sqlpage.
- Ensure compatibility with updated dependencies and improve overall project stability.

* fix handling of one-element arrays in doc code generator

see https://github.com/sqlpage/SQLPage/issues/1079

* In the table component, allow simple objects in custom_actions instead of requiring arrays of objects.

 fix https://github.com/sqlpage/SQLPage/issues/1079

* Implement faster icon loading by inlining icons from the Tabler sprite. The previous method required downloading and parsing a large file, causing delays in icon rendering. Now, icons are generated and cached, improving page load times. Update the icon helper to utilize the new inline method.

* Update tabler icons to version 3.35 and refactor icon extraction logic for improved performance

* icon image helper: logging and error handling

- Changed debug logs to warning logs for invalid icon names and missing icons in the IconImgHelper.
- Updated the way icons are retrieved from the ICON_MAP for better clarity and performance.

* IconImgHelper: use raw string literals for SVG output

* Refactor icon extraction logic in build.rs to improve performance and memory usage. The download_tabler_icons function now directly processes sprite content in memory, eliminating the need for temporary file storage. Updated extract_icons_from_sprite to handle byte slices instead of strings, enhancing efficiency.

* build.rs: raise on missing icon id

* Simlplify icon generation in build.rs

* simplify icon _img helper

* update input field docs

fixes https://github.com/sqlpage/SQLPage/discussions/1081

* better form documentation

* fix ipv6 notation (#1084)

On Mac OS, when localhost:8080 is defined and sqlpage config file, the SocketAddr is resolved with ipv6 address if ip V6 is available on the internal network.

```json
{
  "listen_on": "localhost:8080"
}
```

On the terminal we can Ctrl + Click, but the URL is incorrect (ipV6 notation use bracket)

Actually we have 

```shell
View your website at:
🔗 http://::1:8080
```

Instead of 

```
View your website at:
🔗 http://[::1]:8080
```

Regards,

* Update dependencies in Cargo.lock to latest versions

* Fix github pr ci cache warnings (#1086)

* feat: Add shared-key to cargo cache action

Co-authored-by: contact <contact@ophir.dev>

* Refactor: Use matrix-specific cache key in CI

Co-authored-by: contact <contact@ophir.dev>

* feat: Cache Rust build artifacts only on main branch

Co-authored-by: contact <contact@ophir.dev>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* Enhance SQL performance guidance in migration script

- Added detailed recommendations for using primary and foreign keys, including examples for product and sales tables.
- Introduced best practices for indexing, query performance debugging, and database maintenance commands.
- Included advice on lazy loading and reducing the number of queries to optimize SQLPage applications.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Christophe CHAUVET <christophe.chauvet@gmail.com>
2025-11-08 00:31:38 +01:00
Ophir LOJKINE 2e2c5e9c41 Fix github pr ci cache warnings (#1086)
* feat: Add shared-key to cargo cache action

Co-authored-by: contact <contact@ophir.dev>

* Refactor: Use matrix-specific cache key in CI

Co-authored-by: contact <contact@ophir.dev>

* feat: Cache Rust build artifacts only on main branch

Co-authored-by: contact <contact@ophir.dev>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-11-07 22:00:52 +01:00
lovasoa 5588c296c1 Update dependencies in Cargo.lock to latest versions 2025-11-07 21:59:14 +01:00
Christophe CHAUVET 9b6691ab1e fix ipv6 notation (#1084)
On Mac OS, when localhost:8080 is defined and sqlpage config file, the SocketAddr is resolved with ipv6 address if ip V6 is available on the internal network.

```json
{
  "listen_on": "localhost:8080"
}
```

On the terminal we can Ctrl + Click, but the URL is incorrect (ipV6 notation use bracket)

Actually we have 

```shell
View your website at:
🔗 http://::1:8080
```

Instead of 

```
View your website at:
🔗 http://[::1]:8080
```

Regards,
2025-11-05 22:51:54 +01:00
lovasoa 0d0bd84290 better form documentation 2025-11-05 10:13:02 +01:00
lovasoa 3bd58baf47 update input field docs
fixes https://github.com/sqlpage/SQLPage/discussions/1081
2025-11-04 17:25:21 +01:00
lovasoa c4b398b21c simplify icon _img helper 2025-11-04 16:51:16 +01:00
lovasoa 5c41f16481 Simlplify icon generation in build.rs 2025-11-04 16:46:42 +01:00
lovasoa bb3e75615b build.rs: raise on missing icon id 2025-11-04 16:07:27 +01:00
lovasoa e7726b53fb Refactor icon extraction logic in build.rs to improve performance and memory usage. The download_tabler_icons function now directly processes sprite content in memory, eliminating the need for temporary file storage. Updated extract_icons_from_sprite to handle byte slices instead of strings, enhancing efficiency. 2025-11-04 15:09:28 +01:00
lovasoa df1e6c2184 IconImgHelper: use raw string literals for SVG output 2025-11-04 14:00:02 +01:00
lovasoa 923cb6262f icon image helper: logging and error handling
- Changed debug logs to warning logs for invalid icon names and missing icons in the IconImgHelper.
- Updated the way icons are retrieved from the ICON_MAP for better clarity and performance.
2025-11-04 13:57:36 +01:00
lovasoa 1db0868d77 Update tabler icons to version 3.35 and refactor icon extraction logic for improved performance 2025-11-04 13:51:35 +01:00
lovasoa 52e11df5b6 Implement faster icon loading by inlining icons from the Tabler sprite. The previous method required downloading and parsing a large file, causing delays in icon rendering. Now, icons are generated and cached, improving page load times. Update the icon helper to utilize the new inline method. 2025-11-04 13:38:05 +01:00
lovasoa cec270e1ee In the table component, allow simple objects in custom_actions instead of requiring arrays of objects.
fix https://github.com/sqlpage/SQLPage/issues/1079
2025-11-04 10:32:50 +01:00
lovasoa 26e091a699 fix handling of one-element arrays in doc code generator
see https://github.com/sqlpage/SQLPage/issues/1079
2025-11-04 00:40:23 +01:00
lovasoa 843d9701ce Update dependencies and version for sqlpage to 0.39.1
- Bump versions of several dependencies including `aho-corasick`, `cc`, `clap`, `icu_collections`, and others to their latest releases.
- Update `Cargo.toml` to reflect the new version of sqlpage.
- Ensure compatibility with updated dependencies and improve overall project stability.
2025-11-03 23:56:21 +01:00
Ophir LOJKINE 6b57c4abee Document nginx streaming and compression for sqlpage (#1080)
* Docs: Add Nginx streaming and compression configuration

Co-authored-by: contact <contact@ophir.dev>

* Add NGINX streaming and compression configuration

Co-authored-by: contact <contact@ophir.dev>

* Refactor NGINX proxy settings documentation for clarity

Co-authored-by: contact <contact@ophir.dev>

* Refine NGINX proxy buffering recommendations for streaming

Co-authored-by: contact <contact@ophir.dev>

* Update NGINX proxy buffering settings for improved streaming performance

Revised the documentation to clarify the impact of enabling and disabling proxy buffering in NGINX for SQLPage. Added concise recommendations for handling slow SQL queries and emphasized the importance of adjusting `compress_responses` in `sqlpage.json` when using a reverse proxy.

Co-authored-by: contact <contact@ophir.dev>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-11-03 23:53:48 +01:00
lovasoa c4ffc0dda3 clippy 2025-11-03 09:53:46 +01:00
lovasoa 44fd2e1cca disable response compression by default 2025-11-02 19:05:41 +01:00
Ophir LOJKINE 73044e7016 nice visual error messages for invalid header values
* Feat: Sanitize header values to prevent injection attacks

Co-authored-by: contact <contact@ophir.dev>

* Refactor sanitize_header_value to use Cow and remove test file

Co-authored-by: contact <contact@ophir.dev>

* refactor header error handling in render.rs

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-10-28 23:50:18 +01:00
lovasoa 2e71702c42 clear json in docs 2025-10-28 22:55:47 +01:00
lovasoa a7f05a4328 formatting 2025-10-28 22:54:53 +01:00
lovasoa ee3bad7eeb Enhance SQLPage documentation for execution process and function handling
- Clarify the execution flow of SQL statements in SQLPage, detailing the decision-making process for handling statements.
- Expand on the role of `sqlpage.*` functions and their execution context.
- Improve explanations and examples to illustrate the differences between local handling and database execution.
- Update section titles for better readability and understanding.
2025-10-28 22:53:23 +01:00
lovasoa 034b8485ca Update SQL documentation to clarify SQLPage's execution process and variable handling
- Refactor content for better clarity on how SQLPage processes SQL statements.
- Introduce sections on static simple selects, variable handling, and the execution of `sqlpage.*` functions.
- Improve examples to illustrate the differences between handled and sent queries.
- Enhance explanations regarding performance and data types in SQLPage.
2025-10-28 22:30:08 +01:00
lovasoa c803214766 Add server timing for parameter binding in query execution
- Recorded server timing for the parameter binding process in the query execution flow.
- Updated tests to verify the inclusion of the new timing event in the server timing header.
2025-10-28 16:18:05 +01:00
lovasoa 1e396ac095 Fix missing server timing in some cases
- Updated response handling to use a builder pattern for better clarity and consistency.
- Enhanced server timing format to include microseconds in the output.
- Added a new test for server timing in redirect responses to ensure proper header inclusion.
2025-10-28 16:08:40 +01:00
lovasoa c38a1098d5 changelog
CI / compile_and_lint (push) Has been cancelled
CI / test (mssql, mssql, mssql://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
CI / test (mysql, mysql, mysql://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
CI / test (postgres, odbc, Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!, true) (push) Has been cancelled
CI / test (postgres, postgres, postgres://root:Password123!@127.0.0.1/sqlpage) (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 (macOS & Windows) (.exe, , windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Create Release / Build sqlpage binaries (macOS & Windows) (odbc-static, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
Create Release / Build sqlpage binaries (Linux) (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
v0.39.0
2025-10-28 00:16:15 +01:00
lovasoa abe136d095 fix labels semantics in login component 2025-10-28 00:06:04 +01:00
lovasoa 5ee781cf40 use the login component in the user auth example 2025-10-27 23:36:29 +01:00
lovasoa d542a8ae79 update changelog 2025-10-27 23:23:44 +01:00
lovasoa 5a6192fcfa Merge olivierauverlot/login: combine local defaults with error_message and improved docs 2025-10-27 23:19:21 +01:00
lovasoa cc95ae25de Improve login component documentation and usability
Add complete example with database schema, credential processing, and page protection. Update authentication migration to reference new login component. Enhance login template with default icons and autocomplete attributes. Make validate parameter optional with sensible default.
2025-10-27 23:13:38 +01:00
Olivier Auverlot 3d7f780fbd Documentation improved 2025-10-27 23:13:38 +01:00
Olivier Auverlot 5aa6acb8a0 Documentation improved 2025-10-27 23:13:38 +01:00