Skip to content

fix(mysql): route routine DDL through text protocol#348

Open
Stiwar0098 wants to merge 2 commits into
TabularisDB:mainfrom
Stiwar0098:fix/mcp-mysql-routine-ddl-text-protocol
Open

fix(mysql): route routine DDL through text protocol#348
Stiwar0098 wants to merge 2 commits into
TabularisDB:mainfrom
Stiwar0098:fix/mcp-mysql-routine-ddl-text-protocol

Conversation

@Stiwar0098

Copy link
Copy Markdown
Contributor

Closes #347

PR Type

  • Bug fix

Summary

  • Route MySQL routine DDL through text protocol instead of prepared statements.
  • Cover PROCEDURE/FUNCTION create, alter, drop statements, including CREATE DEFINER variants.
  • Ignore local .atl/ and .opencode/ tooling folders.

Changes

File Change
.gitignore Ignore local AI/tooling directories.
src-tauri/src/drivers/mysql/mod.rs Extend MySQL text-protocol routing for routine DDL unsupported by prepared statements.
src-tauri/src/drivers/mysql/tests.rs Add classifier coverage for routine DDL and negative cases.

Test Plan

  • cargo test text_protocol --lib
  • Focused diff review completed before PR.
  • Live MCP + MySQL execution not run locally.

Notes

MySQL documentation lists the SQL statements permitted in prepared statements and routine DDL is not included. The reported DROP PROCEDURE IF EXISTS sociedades_close; now routes through sqlx::raw_sql() via the existing MySQL text-protocol path.

|| head.starts_with("LOCK TABLES")
|| head.starts_with("UNLOCK TABLES")
|| head.starts_with("DROP PROCEDURE")
|| head.starts_with("CREATE PROCEDURE")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Missing CREATE OR REPLACE variants for PROCEDURE and FUNCTION

MySQL (and MariaDB) support CREATE OR REPLACE PROCEDURE and CREATE OR REPLACE FUNCTION (with or without a DEFINER clause). These statements are not permitted in the prepared-statement protocol, but the current starts_with checks only match CREATE PROCEDURE and CREATE FUNCTION — they will miss queries that include OR REPLACE between CREATE and the routine type.

Examples that will currently fail to route through text protocol:

  • CREATE OR REPLACE PROCEDURE my_proc() ...
  • CREATE OR REPLACE FUNCTION my_func() ...
  • CREATE OR REPLACE DEFINER=root PROCEDURE my_proc() ...
  • CREATE OR REPLACE DEFINER=root FUNCTION my_func() ...

Consider normalising the prefix check, e.g. using a regex or token-based approach, to catch the OR REPLACE optional clause.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 3ee7d39. The classifier now routes CREATE OR REPLACE PROCEDURE and CREATE OR REPLACE FUNCTION through text protocol, including compact and spaced DEFINER variants.

I also tightened the matching so CREATE [OR REPLACE] DEFINER ... VIEW does not route through text protocol just because the view body mentions PROCEDURE or FUNCTION.

Verification: cargo test text_protocol --lib passed via the Tabularis build-skill Rust test path, 5 passed, 0 failed.

|| head.starts_with("LOCK TABLES")
|| head.starts_with("UNLOCK TABLES")
|| head.starts_with("DROP PROCEDURE")
|| head.starts_with("CREATE PROCEDURE")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Missing CREATE OR REPLACE variants for PROCEDURE and FUNCTION

MySQL (and MariaDB) support CREATE OR REPLACE PROCEDURE and CREATE OR REPLACE FUNCTION (with or without a DEFINER clause). These statements are not permitted in the prepared-statement protocol, but the current starts_with checks only match CREATE PROCEDURE and CREATE FUNCTION — they will miss queries that include OR REPLACE between CREATE and the routine type.

Examples that will currently fail to route through text protocol:

  • CREATE OR REPLACE PROCEDURE my_proc() ...
  • CREATE OR REPLACE FUNCTION my_func() ...
  • CREATE OR REPLACE DEFINER=root PROCEDURE my_proc() ...
  • CREATE OR REPLACE DEFINER=root FUNCTION my_func() ...

Consider normalising the prefix check, e.g. using a regex or token-based approach, to catch the OR REPLACE optional clause.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 3ee7d39. This duplicate finding is covered by the same update: CREATE OR REPLACE routine DDL now uses the text-protocol path for PROCEDURE/FUNCTION statements, with tests for direct, compact DEFINER, and spaced DEFINER = 'root' @ 'localhost' forms.

Verification: cargo test text_protocol --lib passed via the Tabularis build-skill Rust test path, 5 passed, 0 failed.

@kilo-code-bot

kilo-code-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 0

Previously Reported Issues

  • ~~src-tauri/src/drivers/mysql/mod.rs line ~1083 — Missing CREATE OR REPLACE variants for PROCEDURE and FUNCTION~~ RESOLVED in 3ee7d39.
Files Reviewed (3 files)
  • .gitignore — No issues
  • src-tauri/src/drivers/mysql/mod.rs — Previous WARNING resolved; no new issues
  • src-tauri/src/drivers/mysql/tests.rs — No issues
Previous Review Summary (commit 661ba81)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 661ba81)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src-tauri/src/drivers/mysql/mod.rs 901 Missing CREATE OR REPLACE variants for PROCEDURE and FUNCTION
Files Reviewed (3 files)
  • .gitignore - No issues
  • src-tauri/src/drivers/mysql/mod.rs - 1 issue
  • src-tauri/src/drivers/mysql/tests.rs - No issues

Fix these issues in Kilo Cloud


Reviewed by kimi-k2.6-20260420 · Input: 58K · Output: 14.3K · Cached: 311K

@kilo-code-bot

kilo-code-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src-tauri/src/drivers/mysql/mod.rs 901 Missing CREATE OR REPLACE variants for PROCEDURE and FUNCTION
Files Reviewed (3 files)
  • .gitignore - No issues
  • src-tauri/src/drivers/mysql/mod.rs - 1 issue
  • src-tauri/src/drivers/mysql/tests.rs - No issues

Fix these issues in Kilo Cloud

@Stiwar0098 Stiwar0098 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed the Kilo review feedback.

This update routes CREATE OR REPLACE PROCEDURE and CREATE OR REPLACE FUNCTION through the MySQL text-protocol path, including DEFINER variants. I also tightened the classifier so CREATE [OR REPLACE] DEFINER ... VIEW statements do not match just because their body mentions PROCEDURE or FUNCTION.

Verification: cargo test text_protocol --lib passed via the Tabularis build-skill Rust test path, 5 passed, 0 failed.

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.

fix(mysql): route routine DDL through text protocol

1 participant