Skip to content

Conversation

@marxhxxx
Copy link

Summary: Create a virtual class to let SqlRunner to be extended.

Differential Revision: D90933335

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 18, 2026
@meta-codesync
Copy link

meta-codesync bot commented Jan 18, 2026

@marxhxxx has exported this pull request. If you are a Meta employee, you can view the originating Diff in D90933335.

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
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
@marxhxxx marxhxxx force-pushed the export-D90933335 branch 2 times, most recently from aa4bb71 to 11061aa Compare January 21, 2026 00:26
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
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
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
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
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
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
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
@marxhxxx marxhxxx force-pushed the export-D90933335 branch 2 times, most recently from 7fdadea to d6635b3 Compare January 21, 2026 07:34
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
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
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
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant