Implement CONTEXT_INFO and SESSION_CONTEXT features - #27
Conversation
This commit adds support for session-level state management in Iridium SQL, matching SQL Server functionality for CONTEXT_INFO and SESSION_CONTEXT. Key changes: - Extended SessionRuntime and related structs to store context_info (128-byte binary) and session_context (key-value store with read-only support). - Added SET CONTEXT_INFO statement support to the parser and executor. - Implemented CONTEXT_INFO() and SESSION_CONTEXT(key) scalar functions. - Implemented sp_set_session_context system stored procedure. - Added context_info column to sys.dm_exec_sessions system view. - Added Value::to_bool() helper for T-SQL truthiness evaluation. - Included comprehensive tests in crates/iridium_core/tests/session_context_test.rs. Co-authored-by: celsowm <369336+celsowm@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
I have implemented a set of features related to session state management, bringing Iridium SQL closer to 1:1 compatibility with SQL Server. Specifically, I added support for
CONTEXT_INFOandSESSION_CONTEXT.Features Implemented:
SET CONTEXT_INFOStatement: Users can now set a 128-byte binary context for their session using literals (e.g.,SET CONTEXT_INFO 0xABCD) or variables.CONTEXT_INFO()Function: A new scalar function to retrieve the current session's context info.SESSION_CONTEXTKey-Value Store: Implemented the SQL Server 2016+ session context feature.sp_set_session_context: A system stored procedure to set key-value pairs, with support for the@read_onlyflag.SESSION_CONTEXT(key): A scalar function to retrieve values by key.sys.dm_exec_sessionsIntegration: Added thecontext_infocolumn to this DMV, enabling introspection of session context.Verification:
crates/iridium_core/tests/session_context_test.rscovering all new features and edge cases (e.g., read-only context keys).iridium_coretest suite (~1300+ tests) to ensure no regressions were introduced.PR created automatically by Jules for task 7295642607711709711 started by @celsowm