SQL tag

<sql/> element can be used to define a reusable fragment of SQL code that can be included in other statements. It's a frequently used element in our daily work, so we introduce two refactor features to help you guys easy working with tag.

Extract <sql/> tag

You can select some elements in mapper XML and follow Refactor → Extract → <sql/> tag or use shortcut ⌘ + ⌥ + M on Mac and Ctrl + Alt + M on Windows to extract a <sql/> tag, and of course, a dialog will popup to ask you to choose an id for the newly created <sql/> tag:

extract

Inline <sql/> tag

You can place the cursor on a <sql/> id element and follow Refactor → Inline or use shortcut ⌘ + ⌥ + N on Mac and Ctrl + Alt + N on Windows to inline the content of a <sql/> element into the place wherever the <sql/> is referenced. This work well even if a <sql/> is referenced from different mapper XML files:

inline

Codes Magic © 2013-2018 · Terms