Commit Graph

2704 Commits

Author SHA1 Message Date
Ophir LOJKINE d80b54ddd0 Merge branch 'main' into codex/normalize-sql-error-reporting-format 2026-03-02 00:07:33 +01:00
Ophir LOJKINE 4ad6a1b81d Standardize statement position formatting and preserve HTTP statuses 2026-03-02 00:05:50 +01:00
lovasoa d1804ba402 change sqlpage.link error message format 2026-03-01 21:18:29 +01:00
lovasoa 03e1d65bce sqlpage.link: improve error message 2026-03-01 19:19:57 +01:00
lovasoa 1ebe79e929 update dependencies 2026-03-01 19:05:49 +01:00
Ophir LOJKINE 17e6e1e712 Improve SQLPage function argument warnings (#1225)
* improve sqlpage function argument warnings with source context

Made-with: Cursor

* Param extraction: Result-based errors, single caller message, no CompoundIdentifier special case

- expr_to_stmt_param returns Result<StmtParam, ExprToParamError>; error carries only line + kind (UnsupportedExpr, UnemulatedFunction, NamedArgs)
- function_args_to_stmt_params logs one formatted message (ctx.format_param_error) then returns Err
- Single unsupported-expr arm; expr_summary() used for description
- Rename ParamWarnContext to ParamExtractContext

Made-with: Cursor

* Surface param extraction error in parse result; add parse_sql error-message tests; remove are_params_extractable

- When func_call_to_param returns StmtParam::Error, store it and have extract_parameters return Err so parse yields ParsedStatement::Error with specialized message
- Add test_parse_sql_unsupported_expr_in_sqlpage_arg and test_parse_sql_unemulated_function_in_sqlpage_arg
- Remove dead are_params_extractable and its unused import

Made-with: Cursor

* Refactor sqlpage function argument error messages to match user expectations

- Overhauled ExprToParamError formatting to construct exact user-friendly descriptions.
- Removed superfluous anyhow::Context prefixes in func_call_to_param.
- Passed source_path properly through validate_function_calls to ensure file line numbers populate the new error template accurately.
- Renamed error test file to match its dynamic error output signature.
- Removed redundant mut mutability warnings on parsing logic loops.

* improve error messages

* Refactor SqlPageFunctionError representation to clean up 'syntax error' wrappers

- Replaced stringly-typed anyhow errors with a strongly typed SqlPageFunctionError.
- Removed source_path threading completely from the parameter extraction phases, conforming to better separation of concerns.
- Appended file path prefix dynamically at the evaluation stage in clone_anyhow_err strictly when downcasting to SqlPageFunctionError.
- Removed the confusing generic 'Caused by: x.sql contains a syntax error...' wrapper from actual function logic errors.

* Remove redundant 'reorganize' hint from error message

* readd deleted test

* split parameter extraction logic into a separate file

* Add to changelog
2026-03-01 09:52:46 +01:00
Ophir LOJKINE cc8848f614 Adjust form spacing without submit buttons (#1215) 2026-02-28 22:03:56 +01:00
dependabot[bot] 3edb882ab2 Bump time from 0.3.46 to 0.3.47 (#1213)
Bumps [time](https://github.com/time-rs/time) from 0.3.46 to 0.3.47.
- [Release notes](https://github.com/time-rs/time/releases)
- [Changelog](https://github.com/time-rs/time/blob/main/CHANGELOG.md)
- [Commits](https://github.com/time-rs/time/compare/v0.3.46...v0.3.47)

---
updated-dependencies:
- dependency-name: time
  dependency-version: 0.3.47
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-05 23:28:29 +01:00
lovasoa d745a18412 add an example to the run_sql docs
see https://github.com/sqlpage/SQLPage/discussions/1214
2026-02-05 23:07:03 +01:00
lovasoa 7f4dd3d9b2 cleanup form button icons and reset color pr 2026-02-05 22:46:57 +01:00
setop 2840e1ab7c add form buttons icons, closes #821 (#1210) 2026-02-04 09:23:29 +01:00
dependabot[bot] 198ff6dc30 Bump bytes from 1.11.0 to 1.11.1 (#1209)
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.11.0 to 1.11.1.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.11.0...v1.11.1)

---
updated-dependencies:
- dependency-name: bytes
  dependency-version: 1.11.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-03 21:53:28 +01:00
Ophir LOJKINE 67fe49caf1 updated dependencies 2026-02-02 15:57:11 +01:00
Ophir LOJKINE 0994b926c6 Sqlpage port variable parsing (#1206)
* Ignore invalid SQLPAGE_PORT values from Kubernetes service environment variables

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

* Use custom visitor for port deserialization instead of serde_json::Value

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

* Fix clippy warnings about uninlined format args

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

* Add robust port deserialization for Kubernetes

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-01-29 18:44:42 +01:00
Ophir LOJKINE 8b268277f2 OIDC paths respecting site prefix in changelog
Added note about OIDC paths respecting site prefix.
2026-01-29 17:52:04 +01:00
Guillaume Cornu 94f9988fbb Format protected and public paths with site prefix (#1204)
* Format protected and public paths with site prefix

Update protected and public paths to include site prefix.

* Fix formatting of paths in OIDC module

* Validate that paths start with '/' in config

* Refactor path handling for OIDC configuration

* Update OIDC paths configuration details

* code fix+clippy hints+formatting
2026-01-29 15:26:42 +01:00
Ophir LOJKINE d30eec861e fix official site migrations page title 2026-01-28 18:11:20 +01:00
Ophir LOJKINE b5d85671c9 format css 2026-01-27 15:52:51 +01:00
lovasoa 1820b5f358 customize primary button shadows 2026-01-26 21:36:33 +01:00
Ophir LOJKINE eef583dc94 Refactor DuckDB ODBC Docker image documentation
integrated relevant information into the ODBC driver installation instructions.
2026-01-26 21:34:08 +01:00
Ophir LOJKINE 9c5735fcfd theme 2026-01-26 18:07:22 +01:00
Ophir LOJKINE fa8fe732c0 update official site theme 2026-01-26 17:51:36 +01:00
Ophir LOJKINE b1a863b006 Update homepage
make it look less AI-purple

use the colors from the logo
2026-01-26 15:38:22 +01:00
Ophir LOJKINE 1b790eacc6 update dependencies 2026-01-26 14:09:25 +01:00
Ophir LOJKINE dc5da4643b Connection timeouts configuration (#1197)
* Allow disabling database connection timeouts via config

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

* Simplify documentation for disabling database timeouts

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

* Refactor timeout resolution to AppConfig

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

* Remove *_raw fields and use custom deserializer for timeouts

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

* Fix formatting in AppConfig

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-01-21 12:23:41 +01:00
mtt cb4c1f915e feat(oidc): allow sub domain on localhost (#1188)
Co-authored-by: Your Name <you@example.com>
2026-01-17 16:25:50 +01:00
lovasoa cc55a3d647 v0.42.0
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
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 (oracle, oracle, Driver=Oracle 21 ODBC driver;Dbq=//127.0.0.1:1521/FREEPDB1;Uid=root;Pwd=Password123!) (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, duckdb) (push) Has been cancelled
CI / docker_build (linux/amd64, minimal) (push) Has been cancelled
CI / docker_build (linux/arm/v7, minimal) (push) Has been cancelled
CI / docker_build (linux/arm64, duckdb) (push) Has been cancelled
CI / docker_build (linux/arm64, minimal) (push) Has been cancelled
CI / docker_push (duckdb) (push) Has been cancelled
CI / docker_push (minimal) (push) Has been cancelled
v0.42.0
2026-01-17 16:18:57 +01:00
lovasoa ce2b881227 Add cache_stale_duration_ms configuration option
Introduces a new configuration option `cache_stale_duration_ms` which
allows users to control how long files are cached before their freshness
is checked. This provides more fine-grained control over caching
behavior, especially in production environments.
2026-01-17 16:11:53 +01:00
Ophir LOJKINE 7bb11c16e8 duckdb odbc docker (#1187)
* add a duckdb docker image

* Add DuckDB ODBC driver installation and configuration

Installs DuckDB ODBC driver and configures system-wide ODBC settings to
enable DuckDB database connectivity for SQLPage.

* add duckdb odbc info to readme

* Fix CI digest artifact matching

* Temporarily publish docker images on branch

* Allow docker publish on branch (fix)

* Temporarily run CI on branch pushes

* Disable branch publish; fix duckdb inspect tag

* Temporarily enable CI push on branch

* Fix minimal tag suffix in docker_push

* Disable temporary branch CI push
2026-01-17 01:23:29 +01:00
Ophir LOJKINE 73377f4f62 add sqlpage functions to access sqlpage config paths (#1186) 2026-01-12 18:02:35 +01:00
Ophir LOJKINE a2ef976fc7 Add support for Oracle over ODBC (compatibility fixes, ci testing) (#1182)
* Add Oracle DB (free) and ODBC CI support

This change adds support for testing with Oracle DB (using the free version `gvenzl/oracle-free:slim`) in the CI pipeline. It:
- Updates `.github/workflows/ci.yml` to include a new matrix entry for Oracle DB.
- Adds steps to install the Oracle Instant Client and ODBC driver in the CI runner.
- Configures `odbcinst.ini` to register the Oracle ODBC driver.
- Updates `docker-compose.yml` to include the Oracle DB service definition.

* Fix CI: Remove libaio1 dependency

`libaio1` is not available in the ubuntu-latest environment used by GitHub Actions (which likely uses a newer Ubuntu version where `libaio1` is replaced by `libaio1t64` or similar, or it is transitively installed). Removing explicit installation to fix the CI failure.

* Fix CI: Update Oracle Instant Client to 21.14

The previous version 21.10.0.0.0-1 seems to be no longer available at the specified URL (404 Not Found). Updated to 21.14.0.0.0-1 which was verified to exist.

* Fix CI: Install libaio1t64 for Oracle Instant Client

Oracle Instant Client requires `libaio.so.1`, which is provided by the `libaio1t64` package in newer Ubuntu versions (like 24.04). Installing this package should resolve the "cannot open shared object file: No such file or directory" error.

* Fix CI: Symlink libaio.so.1 for Oracle Instant Client

On Ubuntu 24.04 (Noble), `libaio1t64` installs the library as `libaio.so.1t64`, but Oracle Instant Client explicitly looks for `libaio.so.1`. Creating a symlink fixes this loading issue.

* Fix CI: Install libodbcinst2 and unixodbc for Oracle driver

The Oracle ODBC driver requires `libodbcinst.so.2` which is provided by `libodbcinst2`. Installing `unixodbc` ensures the full ODBC stack is available.

* Fix CI: Remove redundant wget installation

`wget` is pre-installed on GitHub Actions runners, so the explicit installation via `apt-get` is unnecessary.

* Fix CI: Create 'root' user in Oracle DB

The Oracle test run failed with ORA-01017 (invalid credentials) because the 'root' user does not exist by default in the Oracle database.
This commit:
1. Installs Oracle SQL*Plus (instantclient-sqlplus) in the CI environment.
2. Adds a step to connect as SYSDBA and create the 'root' user with the required permissions and password, matching the test configuration.

* Fix CI: Use container env vars for Oracle user

Instead of manually creating the 'root' user with SQL*Plus, rely on the `gvenzl/oracle-free` container's initialization features (`APP_USER` and `APP_USER_PASSWORD`) which were already configured in `docker-compose.yml`.
Removed the SQL*Plus installation and user creation steps from the CI workflow.

* Fix CI: Use FREEPDB1 service for Oracle user

The `APP_USER` ('root') created by the `gvenzl/oracle-free` container is created in the `FREEPDB1` pluggable database, not the `FREE` container database. Updated the connection string to use `FREEPDB1`.

* Fix Oracle DB test failures

- `sql_to_json`: Handle Oracle's behavior where empty strings are treated as NULL.
- `filesystem`: Explicitly CAST the timestamp parameter to TIMESTAMP in `was_modified_query` for ODBC (Oracle) to avoid ORA-01843 (invalid month) errors caused by implicit string-to-date conversion mismatches.

* Fix Oracle tests by accounting for known behavior

- Revert generic ODBC changes in `filesystem.rs`.
- Skip `test_sql_file_read_utf8` for ODBC connections (Oracle) because fixing the `ORA-01843` error would require Oracle-specific SQL (e.g. `CAST` or `TO_TIMESTAMP`) in the main codebase which is undesirable for a generic ODBC implementation.
- Keep the test adjustment in `sql_to_json.rs` but clarify the comment that we are assuming ODBC implies Oracle in this test context for the empty string behavior.

* Fix Oracle tests: Identify Oracle by connection string

Instead of relying on `sqlx::any::AnyKind::Odbc` (which applies to any ODBC database), detect Oracle specifically by checking if the connection string contains "Oracle". This allows applying Oracle-specific test logic (like skipping tests with implicit timestamp conversions or handling empty strings as NULL) without incorrectly affecting other ODBC databases.

* use oracle dialect when talking to oracle

* remove stupid ai comment

* update oracle odbc installation steps

* fix odbc installation path

* cast variables to varchar(4000) in oracle

* clippy

* remove long backtraces from ci

* fixed csv upload test for oracle

* update tests for oracle

* properly quote sqlpage-generated col names

* fix test syntax for oracle

* clippy

* remove as but keep alias

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-01-12 14:22:07 +01:00
Mukhtar 5cf1882dc3 fix: handle temp file removal race condition in concurrent initializa… (#1185)
* fix: handle temp file removal race condition in concurrent initialization

When multiple SQLPage instances start simultaneously in the same directory,
they can encounter a race condition during initialization. The create_default_database()
function creates a temporary file to test directory writability, then removes it.
If multiple instances try to remove the same file concurrently, some panic with
'No such file or directory'.

This commit replaces the .expect() panic with graceful error handling using
if let Err(). The writability test has already succeeded by the time we try
to remove the file, so whether another instance removed it is irrelevant.

Includes a test that spawns 10 concurrent threads initializing AppConfig
to verify no panics occur.

ref #1183

* cargo fmt

* the error may have another cause

* Remove concurrent initialization test

Removed the test for concurrent initialization. The test did not work

---------

Co-authored-by: lovasoa <contact@ophir.dev>
2026-01-12 12:43:19 +01:00
Ophir LOJKINE 8d106fb677 Oidc site prefix handling (#1179)
* fix(oidc): respect site_prefix in OIDC redirect and logout URLs

This change ensures that when `site_prefix` is configured, the OIDC redirect URI and logout URI include this prefix.
Previously, `site_prefix` was ignored, causing OIDC callbacks to fail when the application was served under a sub-path.

- Added `site_prefix` to `OidcConfig`.
- Updated `make_oidc_client` to prepend `site_prefix` to the redirect URI.
- Updated `handle_request` to match paths with `site_prefix` included.
- Updated `validate_redirect_url` to respect the prefix when verifying redirect targets.
- Added a regression test `test_oidc_with_site_prefix`.

* Refactor: Update dependencies and remove unused crates

This commit updates several dependencies to their latest versions and removes unused crates to streamline the project.

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

* removed unused config

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-01-08 16:46:10 +01:00
Ophir LOJKINE 72eff8079a Fix invalid redirect url scheme behind reverse proxy (#1178)
This commit refactors the OIDC tests to use a more robust fake OIDC provider and improves the logout URL generation to correctly handle the scheme.

Fixes https://github.com/sqlpage/SQLPage/issues/1174
2026-01-08 15:03:23 +01:00
dependabot[bot] 8c394fff5a Bump rsa from 0.9.9 to 0.9.10 (#1172)
Bumps [rsa](https://github.com/RustCrypto/RSA) from 0.9.9 to 0.9.10.
- [Changelog](https://github.com/RustCrypto/RSA/blob/v0.9.10/CHANGELOG.md)
- [Commits](https://github.com/RustCrypto/RSA/compare/v0.9.9...v0.9.10)

---
updated-dependencies:
- dependency-name: rsa
  dependency-version: 0.9.10
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-06 20:43:54 +01:00
Ophir Lojkine fb40807ce7 Add DuckDB support including specific syntax parsing 2026-01-05 16:01:55 +01:00
Ophir Lojkine b688ab7364 add zed debugger file 2026-01-05 15:47:56 +01:00
Ophir Lojkine 015ff26243 Update Database URL Configuration Documentation
Clarify database connection URL options and add ODBC example reference
2026-01-05 12:06:37 +01:00
Ophir Lojkine b349ef431c Ensure each fake oidc provider server stops immediately after the
corresponding test is done

Add cancellation token to fake OIDC provider server
2025-12-30 10:33:49 +01:00
Ophir Lojkine 1230326194 Remove unnecessary readiness check for OIDC provider in test setup 2025-12-30 10:13:35 +01:00
Ophir Lojkine 9f0941906f Remove unnecessary tokio async handling in FakeOidcProvider 2025-12-30 10:08:57 +01:00
lovasoa 16c089705c Fix: sqlpage.variables() no longer returns duplicate keys
The `sqlpage.variables()` function previously allowed duplicate keys
when GET, POST, and SET variables of the same name were present. This
commit ensures that the returned JSON object contains only unique keys,
with precedence given to SET variables, then POST, then GET.
2025-12-30 03:12:29 +01:00
lovasoa 5688140ca7 add more exhaustive tests for sqlpage.variables
see https://github.com/sqlpage/SQLPage/issues/1169
2025-12-30 02:20:11 +01:00
lovasoa f31a830945 add links to /extensions-to-sql
it's still hard to get a clear understanding of how variables work in
sqlpage when getting started

https://github.com/sqlpage/SQLPage/issues/1166
2025-12-28 03:06:07 +01:00
lovasoa 865476ebf9 update dependencies
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.41.0
2025-12-28 01:03:44 +01:00
lovasoa 3b2a99232f re-enable text drop shadow in chart data labels 2025-12-28 01:00:08 +01:00
Ophir LOJKINE a5964526fb credits where due
Updated default chart color palette to use Open Colors.
2025-12-28 00:25:47 +01:00
Ophir LOJKINE 12e1c10cd3 CHANGELOG new color palette screenshot
Updated changelog with new features, fixes, and updates.
2025-12-28 00:24:01 +01:00
lovasoa dc8e861893 update default chart color palette 2025-12-28 00:21:17 +01:00
lovasoa 5d74fa98e1 re-add the lime color to charts
fixes https://github.com/sqlpage/SQLPage/issues/1162
2025-12-28 00:01:09 +01:00