Skip to content

feat: stored procedures and functions#696

Open
datlechin wants to merge 31 commits intomainfrom
feat/browse-stored-procedures
Open

feat: stored procedures and functions#696
datlechin wants to merge 31 commits intomainfrom
feat/browse-stored-procedures

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

@datlechin datlechin commented Apr 12, 2026

Summary

Full stored procedure and function management for MySQL, MariaDB, PostgreSQL, and SQL Server (#693):

  • Browse routines in a dedicated sidebar section with distinct icons (functions: purple, procedures: teal)
  • Double-click to open routine detail view with Definition, Parameters, and DDL tabs
  • Execute procedures/functions with parameter input dialog and SQL preview
  • Create new procedures/functions from database-specific templates
  • Drop with confirmation dialog
  • View definition opens in query tab

Changes

New files (9):

  • PluginRoutineInfo.swift / PluginRoutineParameterInfo.swift — plugin transfer types
  • RoutineInfo.swift / RoutineParameterInfo.swift / RoutineDetailTab.swift — app models
  • RoutineRowView.swift — sidebar row with type-based icons
  • RoutineDetailView.swift + DataLoading extension — tabbed detail view (Definition/Parameters/DDL)
  • ExecuteRoutineSheet.swift — execute dialog with parameter inputs and SQL preview

Plugin protocol (3 new methods + defaults):

  • fetchRoutineParameters(routine:type:schema:) — parameter metadata
  • createProcedureTemplate() / createFunctionTemplate() — creation templates

Database implementations:

DB Parameters Definition Execute syntax
MySQL INFORMATION_SCHEMA.PARAMETERS SHOW CREATE PROCEDURE/FUNCTION CALL / SELECT
PostgreSQL pg_get_function_arguments(oid) pg_get_functiondef(oid) CALL / SELECT
MSSQL INFORMATION_SCHEMA.PARAMETERS OBJECT_DEFINITION EXEC / SELECT

Tab system integration:

  • QueryTab + EditorTabPayload + PersistedTab — added isRoutine and routineType fields
  • MainEditorContentView — renders RoutineDetailView when showStructure && isRoutine

Sidebar enhancements:

  • DoubleClickDetector on routine rows
  • Context menu: View Definition, Execute..., Drop, Copy Name
  • Section header context menu: Create Procedure..., Create Function...

No ABI version bump needed — all new protocol methods have default implementations.

Closes #693

Test plan

  • MySQL: create procedure + function, verify sidebar listing, double-click opens detail view with 3 tabs
  • MySQL: right-click Execute → parameter input dialog → SQL preview → opens in query tab
  • MySQL: right-click Drop → confirmation → routine removed from sidebar
  • MySQL: section header → Create Procedure/Function → template opens in query tab
  • PostgreSQL: same flow, verify overloaded functions show one entry per name
  • PostgreSQL: parameters parsed correctly from pg_get_function_arguments
  • SQL Server: same flow, verify EXEC syntax in execute dialog
  • SQLite/Redis/ClickHouse: no Routines section, no Create menu items
  • Tab persistence: open routine detail, quit, reopen → tab restores
  • View Definition with no tabs open → opens inline (not new window)
  • Search filters routines alongside tables
  • Collapse/expand Routines section persists across sessions

@datlechin datlechin changed the title feat: browse stored procedures and functions in sidebar feat: stored procedures and functions - browse, detail view, execute, create, drop Apr 12, 2026
@datlechin datlechin changed the title feat: stored procedures and functions - browse, detail view, execute, create, drop feat: stored procedures and functions Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No way to browse stored procedures and functions

1 participant