feat: add backend SQL construction service and fix query result display#118
Open
Blankll wants to merge 1 commit into
Open
feat: add backend SQL construction service and fix query result display#118Blankll wants to merge 1 commit into
Blankll wants to merge 1 commit into
Conversation
- Add sql_service.rs — centralized SQL wrapping with sqlparser validation, trailing semicolon/comment stripping, schema injection, and structured sort/filter/pagination construction. Replaces frontend buildWrappedSql. - Add execute_sorted_query Tauri command — structured sort/filter API that derives database type from the active connection. - Fix DataGrid virtual scroller — move column header outside scroll container so rows with 0-1 results aren't hidden behind sticky header. - Fix statement parser — replace line-based + regex approach with character-based state machine that correctly handles correlated subqueries spanning multiple lines. - Add hideBatchActions prop to DataGrid to suppress batch action bar in query result panel (no table context for delete/export). - Type-aware table search — UUID/JSON columns use ::text cast instead of fragile CAST(... AS TEXT), with exact-match optimization.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Moves all SQL construction (wrapping, filtering, sorting, pagination) from the frontend to the backend with proper
sqlparser-based parsing and validation.Changes
sql_service.rs (new)
Centralized SQL construction service. Handles:
--comments before wrappingsqlparserto validate single SELECT/WITH statementsQueryResultPanel.vue
buildWrappedSql— frontend no longer constructs SQL stringsexecute_sorted_querycommandDataGrid.vue
so rows are never hidden behind the sticky header
hideBatchActionsprop to suppress batch action bar in queryresult panel
useSqlStatements.ts
state machine that tracks quotes, backticks, and comments
(SELECT count(*) FROM t WHERE x = y) as aliassearch.rs
::textcast instead ofCAST(... AS TEXT)::textfor compatibilityTesting
comments, multi-statement rejection, DML rejection, schema injection,
filter/sort/pagination, MySQL and SQL Server dialects