Standalone SQL Preview Workbench
There is no Wrapper call to click and you would rather not create a mapper file just to see the result — you copied a statement from somewhere else and want to know what it actually assembles into and how the parameters land in it. The standalone workbench exists for exactly that: paste, parse, inspect, and run it if you need to.
How to open it
| Route | Action |
|---|---|
| Side panel | The "SQL Preview" tab inside the SQL Visualizer tool window |
| Menu | Tools → "Open SQL Preview Workbench" |
| Shortcut | Alt+Shift+P (macOS Cmd+Shift+P) |
When the clipboard already holds something that looks like SQL or a mapper XML fragment, opening through the menu or the shortcut prefills it for you. The tab itself never prefills — paste when you are ready.
What it recognises
Paste into the input area and click "Parse & Preview". Recognition weighs the evidence in the fragment:
| Form | Notes |
|---|---|
| Plain SQL | A complete statement with ? or #{name} placeholders |
| Mapper XML statement block | A fragment containing <select> / <insert> / <update> / <delete> tags — it does not have to be a full <mapper> file |
| iBatis 2 statement | <dynamic> / <isNotNull> condition tags, #id# / $name$ placeholder syntax |
| Escaped forms | < / > tags copied out of a web page, fragments wrapped in a markdown code fence |
Tag names overlap heavily between mapper XML and iBatis 2, so the decision weighs proprietary tags, attributes, placeholder syntax and DTD. When the evidence is not decisive, both parsing chains are tried and the one that works wins. If the fragment holds several statements, the first is shown and the status line tells you how many there are and that splitting the fragment reveals the rest.
The input is capped at 100,000 characters, the same limit MCP uses for fragments. Anything longer is refused with an explanation rather than silently truncated and half-parsed.
What you can do with the result
The top toolbar holds the input-side actions: Parse & Preview, Format, Clear, Open in Dialog, Load from File…. Once parsing succeeds, two output actions appear at the bottom:
| Action | What it does |
|---|---|
| Execute SQL | Runs through the same execution chain as statement preview — data source selection, write confirmation, the ${} confirmation gate, the dialect gate, results in the embedded console. Disabled until you parse |
| Copy SQL | Copies the runnable SQL without comments, with parameters rendered as the values you filled in |
"Open in Dialog" hands the current input to the full preview dialog for finer value filling and condition toggling; the actions there behave exactly as they do for statement preview.
Static checks on paste
A successful parse immediately runs the static performance rules, and the findings land in the same performance-advice line the preview panel already has — SELECT *, a missing WHERE clause and similar issues show up at a glance. The rules are shared with statement preview and never duplicated, so the advice here cannot contradict what you see elsewhere.
Open the dialog first, paste afterwards
"Open in Dialog" gives you an empty dialog even when the input is empty, instead of refusing for lack of content. Paste straight into that editor and roughly 0.8 seconds of silence is enough for it to recognise parameters and condition rows — the same result as parsing in the tab first. Once recognition succeeds it stops rewriting your input, so further edits are yours alone.
Dialogs opened from ordinary statement preview are unaffected: there the editing is aimed at the output, and must not be overwritten.
Fill in a missing fragment on the spot
If the preview references a <sql> fragment that is not available in the current context, the result area says "Missing fragment: X — click to fill it in". Click, paste the fragment body, and the SQL re-parses in place with the fragment expanded — no round trip through the source files. The fill-in box also offers "Choose from file…", which pulls the matching <sql id> block out of a mapper XML you pick.
Dialogs opened from a gutter icon, the SQL log or history do not show this entry point: there is no original text there to re-parse, so the link would do nothing.
Load from file
"Load from file…" in the input toolbar takes a mapper XML from the project, replaces the input with its content and parses it directly, with the status line reporting the file name it loaded (and noting when your previous input was replaced). Files over 100,000 characters are not loaded — the input area stays as it was and the reason is stated.
This entry point exists only in the workbench. The preview dialog is a shared display layer used by more than twenty entry points across the plugin, and swapping the file in there would silently change where the statement came from — so it deliberately does not offer it.
The ${} notice for plain SQL
If pasted plain SQL contains an unescaped ${...}, an informational notice appears above the result area: the statement contains raw substitutions whose text is not escaped, which is an injection surface. Dismiss it and it stays quiet for the rest of the session.
Counting matches the mapper XML side: ${} inside string literals or comments counts as a literal and is not reported, and the \${ escape form is not reported either. Without this notice, the only defences for pasted SQL are the confirmation prompt before execution and the comment added on copy — paste alone would not reveal that the statement carries raw substitution.
Known boundaries
- The workbench is a "pasted text" entry point and has no project context:
<include>only resolves through the fill-in box, and entity resolution and type inference work from what the fragment itself says - The tab's presence is backed by the Registry key
sqlvis.preview.standaloneTab; when disabled the tab is not mounted, and opening through the menu or shortcut returns a notification pointing at the key rather than failing silently - One statement is shown at a time. When the fragment holds several, the status line reports the total — split the fragment to work through the rest
Have a suggestion or hit a problem? Open the feedback pool