I found this 4-year old topic
because I'm missing exactly this capability.
I thend to forget how to convert timezones in my DB to my local timezone so I created a macro which cuts out my current selection and puts the SQL code for converting the timezone around it.
Would be greate I could store this macro and maybe bind it to some shortcut.
This has not been implemented yet, partly because very few have shown an interest in it. I have added you vote for it so we will discuss it again.
For anybody on a Mac, this might help. As you saw above, my goal was to have selected text to be surrounded by some fixed text which makes NySQL/MariaDB convert a column to my local timezone.
wolud become this
CONVERT_TZ(last_scan, '+00:00', @@global.time_zone) as last_scan
Here is how I do it now.
Copy attached script "TimeZoneConvert.scpt" into ~/Library/Scripts/DbVisualizer and note that this path will most probably not exist yet.
In Script Editor's preferences, (/Applications/Utilities/Script Editor) enable the script Menu.
When in DbVisualizer's Editor, select the word(s) you want to be surrounded by mentioned text. Then click the Script Menu -> DbVisualizer -> TimeZoneConvert and see how the text is replaced.
Open in Script Editor the TimeZoneConvert script and adjust it to you needs and store it under a different name. You can store as many other "Macros" as you want.
Great, thanks for sharing this script!
If you happen to know jEdit, take a look at its macro system. Something like that would be fantastic. Macros are simply stored as files in a specific directory and its subdirectories. The content of that directory can be found in a macro menu. Every subdirectory is a sub-menu. Additionally keybindings are possible.