Skip to content

Conversation

@lovasoa
Copy link
Collaborator

@lovasoa lovasoa commented Nov 19, 2025

Refactor request handling to separate immutable request data from mutable execution state.

This change avoids unnecessary cloning of large data structures like HTTP headers, cookies, and request bodies during nested run_sql() calls, improving performance and clarifying data ownership.


Open in Cursor Open in Web

lovasoa and others added 7 commits November 19, 2025 02:11
- 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)
- Warn when both URL and POST have same variable name
- Warn when $var is used for POST-only variable (should use :var)
No need to branch on whether variables are provided since we clone in both cases anyway.
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
@lovasoa lovasoa changed the base branch from execution-context to main November 19, 2025 02:00
@lovasoa lovasoa marked this pull request as ready for review November 19, 2025 10:46
@lovasoa lovasoa merged commit 75ade13 into main Nov 19, 2025
10 checks passed
@lovasoa lovasoa deleted the cursor/refactor-request-handling-to-separate-data-and-state-0f57 branch November 19, 2025 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants