feat: prompt for query placeholders before run#51
Merged
Conversation
A query containing `$1, $2, …` or `:name` opens a popup that collects values, substitutes them as text into the SQL, and dispatches. Values are persisted per (connection, normalized query) so re-running the same statement pre-fills the last execution's inputs. Strings need their own quotes; expressions (now(), NULL, casts) are accepted as-is.
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
$1, $2, …and:namein user SQL and open a popup that collects values before dispatch.'foo',42,NULL, or any SQL expression; works identically across Postgres / MySQL / SQLite without per-driver bind plumbing.(connection, normalized SQL)under.rowdy/params/<conn>.json; re-running the same statement re-opens the popup pre-filled.Notes
sqlparser::tokenizer, so$1or:nameinside string literals and comments are correctly ignored.$as an identifier-start, so$Ntokenizes as a Word there — handled explicitly.?is intentionally not treated as a placeholder (would collide withLIKE '%?%').Test plan
cargo test— 575 passed (13 new inplaceholders, 3 inparam_history).cargo clippy— clean.SELECT * FROM pg_stat_activity WHERE pid = $1→ popup, enterpg_backend_pid(), runs. Re-run pre-fills.DELETE FROM t WHERE id = $1) shows destructive confirm first, then params popup.