fix(mysql): route view DDL through text protocol#390
Conversation
create_view, alter_view and drop_view executed their statements via
sqlx::query(), which uses MySQL's prepared-statement protocol. MySQL
rejects CREATE VIEW / ALTER VIEW there with error 1295 ("This command
is not supported in the prepared statement protocol yet"), so saving a
view from the view editor failed.
Route all three through sqlx::raw_sql() (COM_QUERY text protocol),
matching the existing handling for transaction-control statements.
|
Nice fix — thanks for this! I pulled it down and went through it locally, and it holds up well. I traced the Save path to make sure your reasoning checks out, and it does: the view editor goes I also double-checked the "no behavioral change" claim: the old One tiny thing, not a blocker: LGTM, approving. 👍 |
What
Routes MySQL
create_view,alter_viewanddrop_viewthroughsqlx::raw_sql()(theCOM_QUERYtext protocol) instead ofsqlx::query().Why
Saving a view from the view editor failed with:
sqlx::query()uses MySQL's prepared-statement protocol (COM_STMT_PREPARE+COM_STMT_EXECUTE), and MySQL rejectsCREATE VIEW/ALTER VIEWthere with error 1295. The dedicated view-DDL functions are a separate code path from the editor'sexecute_query, so they never got the text-protocol treatment that transaction-control statements already have (is_text_protocol_stmt).How
create_view/alter_view/drop_viewnow execute viasqlx::raw_sql(&query), mirroring the existing handling documented aroundis_text_protocol_stmt. No behavioral change for callers; the statements simply go over the text protocol that MySQL accepts for DDL.Scope
Complementary to #348 (which routes routine DDL through the text protocol via the execute path); this fixes the dedicated view DDL functions called by the view editor's Save action. Postgres and SQLite are unaffected — error 1295 is specific to MySQL's prepared-statement protocol.
Testing
cargo check --no-default-featurespasses.raw_sql.