-
Notifications
You must be signed in to change notification settings - Fork 57
refactor: Allow SqlQueryRunner to be extended #767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
marxhxxx
wants to merge
1
commit into
facebookincubator:main
Choose a base branch
from
marxhxxx:export-D90933335
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
marxhxxx
pushed a commit
to marxhxxx/axiom
that referenced
this pull request
Jan 18, 2026
Summary: Create a virtual class to let SqlRunner to be extended. Differential Revision: D90933335
5a1494a to
7b6939d
Compare
marxhxxx
pushed a commit
to marxhxxx/axiom
that referenced
this pull request
Jan 20, 2026
…incubator#767) Summary: feat: Make SqlQueryRunner run/parse functions to be extensible. Differential Revision: D90933335
aa4bb71 to
11061aa
Compare
marxhxxx
pushed a commit
to marxhxxx/axiom
that referenced
this pull request
Jan 21, 2026
…kincubator#767) Summary: This change introduces a command registration pattern to `SqlQueryRunner`, replacing the hardcoded if-else branches in `Console::readCommands` with a flexible, extensible command handling system. ## Why The previous implementation had all command handling logic scattered in `Console.cpp` with a series of if-else branches checking command prefixes. This made it difficult to: - Add new commands without modifying Console - Extend SqlQueryRunner for different use cases - Test command handlers in isolation ## What Changed **New Command Infrastructure in SqlQueryRunner:** - Added `CommandResult` struct with `handled`, `message`, `results`, and `shouldExit` fields - Added `CommandHandler` function type for consistent handler signatures - Implemented prefix-based command matching with longest-match-first semantics **Public API (SqlQueryRunner.h):** - `registerDefaultCommands(options)` - Sets up built-in commands (exit, quit, help, savehistory, clearhistory, session) - `handleCommand(command)` - Dispatches commands to registered handlers or SQL executor **Private Implementation Details:** - `registerCommand(prefix, handler)` - Registers a handler for a command prefix - `setExecuteHandler(handler)` - Sets the SQL execution handler for non-command input - `saveHistory(path)` / `clearHistory()` - History management utilities **Console Simplification:** - `Console::readCommands` now delegates to `runner_.handleCommand()` - Removed command-specific logic from Console - Console focuses purely on input/output handling **RunOptions Enhancement:** - Added `historyPath` field to consolidate execution parameters Differential Revision: D90933335
11061aa to
79e33e0
Compare
marxhxxx
pushed a commit
to marxhxxx/axiom
that referenced
this pull request
Jan 21, 2026
…kincubator#767) Summary: This change introduces a command registration pattern to `SqlQueryRunner`, replacing the hardcoded if-else branches in `Console::readCommands` with a flexible, extensible command handling system. ## Why The previous implementation had all command handling logic scattered in `Console.cpp` with a series of if-else branches checking command prefixes. This made it difficult to: - Add new commands without modifying Console - Extend SqlQueryRunner for different use cases ## What Changed **New Command Infrastructure in SqlQueryRunner:** - Added `CommandResult` struct with `handled`, `message`, `results`, and `shouldExit` fields - Added `CommandHandler` function type for consistent handler signatures - Implemented prefix-based command matching with longest-match-first semantics **Public API (SqlQueryRunner.h):** - `registerDefaultCommands(options)` - Sets up built-in commands (exit, quit, help, savehistory, clearhistory, session) - `handleCommand(command)` - Dispatches commands to registered handlers or SQL executor Differential Revision: D90933335
79e33e0 to
de929d4
Compare
marxhxxx
pushed a commit
to marxhxxx/axiom
that referenced
this pull request
Jan 21, 2026
…kincubator#767) Summary: This change introduces a command registration pattern to `SqlQueryRunner`, replacing the hardcoded if-else branches in `Console::readCommands` with a flexible, extensible command handling system. ## Why The previous implementation had all command handling logic scattered in `Console.cpp` with a series of if-else branches checking command prefixes. This made it difficult to: - Add new commands without modifying Console - Extend SqlQueryRunner for different use cases ## What Changed **New Command Infrastructure in SqlQueryRunner:** - Added `CommandResult` struct with `handled`, `message`, `results`, and `shouldExit` fields - Added `CommandHandler` function type for consistent handler signatures - Implemented prefix-based command matching with longest-match-first semantics **Public API (SqlQueryRunner.h):** - `registerDefaultCommands(options)` - Sets up built-in commands (exit, quit, help, savehistory, clearhistory, session) - `handleCommand(command)` - Dispatches commands to registered handlers or SQL executor Differential Revision: D90933335
de929d4 to
dbc71b9
Compare
marxhxxx
pushed a commit
to marxhxxx/axiom
that referenced
this pull request
Jan 21, 2026
…kincubator#767) Summary: This change introduces a command registration pattern to `SqlQueryRunner`, replacing the hardcoded if-else branches in `Console::readCommands` with a flexible, extensible command handling system. ## Why The previous implementation had all command handling logic scattered in `Console.cpp` with a series of if-else branches checking command prefixes. This made it difficult to: - Add new commands without modifying Console - Extend SqlQueryRunner for different use cases ## What Changed **New Command Infrastructure in SqlQueryRunner:** - Added `CommandResult` struct with `handled`, `message`, `outcomes`, and `shouldExit` fields - Added `CommandHandler` function type for consistent handler signatures - Implemented prefix-based command matching with longest-match-first semantics **Public API (SqlQueryRunner.h):** - `registerDefaultCommands(options)` - Sets up built-in commands (exit, quit, help, savehistory, clearhistory, session) - `handleCommand(command)` - Dispatches commands to registered handlers or SQL executor Differential Revision: D90933335
dbc71b9 to
92c55e4
Compare
marxhxxx
pushed a commit
to marxhxxx/axiom
that referenced
this pull request
Jan 21, 2026
…kincubator#767) Summary: This change introduces a command registration pattern to `SqlQueryRunner`, replacing the hardcoded if-else branches in `Console::readCommands` with a flexible, extensible command handling system. ## Why The previous implementation had all command handling logic scattered in `Console.cpp` with a series of if-else branches checking command prefixes. This made it difficult to: - Add new commands without modifying Console - Extend SqlQueryRunner for different use cases ## What Changed **New Command Infrastructure in SqlQueryRunner:** - Added `CommandResult` struct with `handled`, `message`, `outcomes`, and `shouldExit` fields - Added `CommandHandler` function type for consistent handler signatures - Implemented prefix-based command matching with longest-match-first semantics **Public API (SqlQueryRunner.h):** - `registerDefaultCommands(options)` - Sets up built-in commands (exit, quit, help, savehistory, clearhistory, session) - `handleCommand(command)` - Dispatches commands to registered handlers or SQL executor Differential Revision: D90933335
92c55e4 to
e6169d0
Compare
marxhxxx
pushed a commit
to marxhxxx/axiom
that referenced
this pull request
Jan 21, 2026
…kincubator#767) Summary: This change introduces a command registration pattern to `SqlQueryRunner`, replacing the hardcoded if-else branches in `Console::readCommands` with a flexible, extensible command handling system. ## Why The previous implementation had all command handling logic scattered in `Console.cpp` with a series of if-else branches checking command prefixes. This made it difficult to: - Add new commands without modifying Console - Extend SqlQueryRunner for different use cases ## What Changed **New Command Infrastructure in SqlQueryRunner:** - Added `CommandResult` struct with `handled`, `message`, `outcomes`, and `shouldExit` fields - Added `CommandHandler` function type for consistent handler signatures - Implemented prefix-based command matching with longest-match-first semantics **Public API (SqlQueryRunner.h):** - `registerDefaultCommands(options)` - Sets up built-in commands (exit, quit, help, savehistory, clearhistory, session) - `handleCommand(command)` - Dispatches commands to registered handlers or SQL executor Differential Revision: D90933335
e6169d0 to
61cff59
Compare
marxhxxx
pushed a commit
to marxhxxx/axiom
that referenced
this pull request
Jan 21, 2026
…kincubator#767) Summary: This change introduces a command registration pattern to `SqlQueryRunner`, replacing the hardcoded if-else branches in `Console::readCommands` with a flexible, extensible command handling system. ## Why The previous implementation had all command handling logic scattered in `Console.cpp` with a series of if-else branches checking command prefixes. This made it difficult to: - Add new commands without modifying Console - Extend SqlQueryRunner for different use cases ## What Changed **New Command Infrastructure in SqlQueryRunner:** - Added `CommandResult` struct with `handled`, `message`, `outcomes`, and `shouldExit` fields - Added `CommandHandler` function type for consistent handler signatures - Implemented prefix-based command matching with longest-match-first semantics **Public API (SqlQueryRunner.h):** - `registerDefaultCommands(options)` - Sets up built-in commands (exit, quit, help, savehistory, clearhistory, session) - `handleCommand(command)` - Dispatches commands to registered handlers or SQL executor Differential Revision: D90933335
7fdadea to
d6635b3
Compare
marxhxxx
pushed a commit
to marxhxxx/axiom
that referenced
this pull request
Jan 21, 2026
…ator#767) Summary: Introduces an extensible command registrating/handling system to SqlQueryRunner, replacing hardcoded if-else branches in Console with a flexible registration pattern. **Key Changes:** - Added `CommandResult` with `outcomes` vector to support multiple statement results - Added `StatementOutcome` struct with message, data, and timing fields - Move `Timing` struct and `time()` template to SqlQueryRunner - Implemented prefix-based command matching with longest-match-first semantics - Commands (exit, quit, help, savehistory, clearhistory, session) now register via `registerCommands()` - `handleCommand()` dispatches to registered handlers or the SQL executor - Console now uses `printOutcomes()` helper to reduce code duplication This enables KoskiSqlRunner and other subclasses to customize command behavior while reusing the console infrastructure. Differential Revision: D90933335
d6635b3 to
a2f4f2a
Compare
marxhxxx
pushed a commit
to marxhxxx/axiom
that referenced
this pull request
Jan 21, 2026
…ator#767) Summary: Introduces an extensible command registrating/handling system to SqlQueryRunner, replacing hardcoded if-else branches in Console with a flexible registration pattern. **Key Changes:** - Added `CommandResult` with `outcomes` vector to support multiple statement results - Added `StatementOutcome` struct with message, data, and timing fields - Move `Timing` struct and `time()` template to SqlQueryRunner - Implemented prefix-based command matching with longest-match-first semantics - Commands (exit, quit, help, savehistory, clearhistory, session) now register via `registerCommands()` - `handleCommand()` dispatches to registered handlers or the SQL executor - Console now uses `printOutcomes()` helper to reduce code duplication This enables KoskiSqlRunner and other subclasses to customize command behavior while reusing the console infrastructure. Differential Revision: D90933335
a2f4f2a to
d5ef0de
Compare
marxhxxx
pushed a commit
to marxhxxx/axiom
that referenced
this pull request
Jan 21, 2026
…ator#767) Summary: Introduces an extensible command registrating/handling system to SqlQueryRunner, replacing hardcoded if-else branches in Console with a flexible registration pattern. **Key Changes:** - Added `CommandResult` with `outcomes` vector to support multiple statement results - Added `StatementOutcome` struct with message, data, and timing fields - Move `Timing` struct and `time()` template to SqlQueryRunner - Implemented prefix-based command matching with longest-match-first semantics - Commands (exit, quit, help, savehistory, clearhistory, session) now register via `registerCommands()` - `handleCommand()` dispatches to registered handlers or the SQL executor - Console now uses `printOutcomes()` helper to reduce code duplication This enables KoskiSqlRunner and other subclasses to customize command behavior while reusing the console infrastructure. Differential Revision: D90933335
d5ef0de to
ad0db4a
Compare
…ator#767) Summary: Introduces an extensible command registrating/handling system to SqlQueryRunner, replacing hardcoded if-else branches in Console with a flexible registration pattern. **Key Changes:** - Added `CommandResult` with `outcomes` vector to support multiple statement results - Added `StatementOutcome` struct with message, data, and timing fields - Move `Timing` struct and `time()` template to SqlQueryRunner - Implemented prefix-based command matching with longest-match-first semantics - Commands (exit, quit, help, savehistory, clearhistory, session) now register via `registerCommands()` - `handleCommand()` dispatches to registered handlers or the SQL executor - Console now uses `printOutcomes()` helper to reduce code duplication This enables KoskiSqlRunner and other subclasses to customize command behavior while reusing the console infrastructure. Differential Revision: D90933335
ad0db4a to
5bbb936
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary: Create a virtual class to let SqlRunner to be extended.
Differential Revision: D90933335