You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor request handling to separate data and state (#1111)
* 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)
* Restore deprecation warning for SET on POST variable names
* 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)
* Simplify run_sql: always use clone_without_variables
No need to branch on whether variables are provided since we clone in both cases anyway.
* Revert "Simplify run_sql: always use clone_without_variables"
This reverts commit 60f5a05.
* 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
* Refactor: Rename RequestInfo to ExecutionContext
Co-authored-by: contact <contact@ophir.dev>
* avoid cloning request
* improve run_sql invalid variables error message
* changelog
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,8 @@
25
25
-`sqlpage.variables('set')` returns only user-defined SET variables as JSON
26
26
-`sqlpage.variables()` returns all variables merged together, with SET variables taking precedence
27
27
-**Deprecation warnings**: Using `$var` when both a URL parameter and POST parameter exist with the same name now shows a warning. In a future version, you'll need to explicitly choose between `$var` (URL) and `:var` (POST).
28
+
- Improved performance of `sqlpage.run_sql`.
29
+
- On a simple test that just runs 4 run_sql calls, the new version is about 2.7x faster (15,708 req/s vs 5,782 req/s) with lower latency (0.637 ms vs 1.730 ms per request).
"Deprecation warning! There is both a URL parameter named '{x}' with value '{url_val}' and a form field named '{x}' with value '{post_val}'. \
177
-
SQLPage is using the value from the form submission, but this is ambiguous, can lead to unexpected behavior, and will stop working in a future version of SQLPage. \
178
-
To fix this, please rename the URL parameter to something else, and reference the form field with :{x}."
175
+
"Deprecation warning! There is both a URL parameter named '{x}' and a form field named '{x}'. \
176
+
SQLPage is using the URL parameter for ${x}. Please use :{x} to reference the form field explicitly."
179
177
);
180
178
}else{
181
-
log::warn!("Deprecation warning! ${x} was used to reference a form field value (a POST variable) instead of a URL parameter. This will stop working soon. Please use :{x} instead.");
179
+
log::warn!(
180
+
"Deprecation warning! ${x} was used to reference a form field value (a POST variable). \
181
+
This now uses only URL parameters. Please use :{x} instead."
0 commit comments