Here's one real-world application I've been finding pretty handy. I have a "SQL replace" node that opens up the SQL console with a template for a SELECT/UPDATE query that one can use to make regex replacements to tags. By default, the UPDATE parts are commented out so that the SELECT runs as a preview of the changes. When they look as they should, simply uncomment the UPDATE and SET lines and comment out the SELECT and FROM. This is from the older SQLite before the new UPDATE…FROM syntax that's available in the component now.
/* Enter regex to find text to replace in FINDREGEX
regex to form replacement in REPLACEREGEX
field to write change to in WRITEFIELD
field to read text to change in READFIELD
*/
-- UPDATE PlaylistUpdatable -- un-comment to replace
-- SET WRITEFIELD =
SELECT -- preview, comment out to update
regexp_replace(
FINDREGEX
, REPLACEREGEX
, READFIELD
)
FROM PlaylistUpdatable -- preview, comment out to update
WHERE PlaylistUpdatable.playlist_index = active_playlist()
AND PlaylistUpdatable.item_is_selected
For instance, if one wanted to zero-pad single-digit numbers in the album titles into an album sort tag, fill in the following:
-- UPDATE PlaylistUpdatable -- un-comment to replace
-- SET albumsortorder =
SELECT -- preview, comment out to update
regexp_replace(
'\b(\d)\b'
, '0$1'
, album
)
FROM PlaylistUpdatable -- preview, comment out to update
WHERE PlaylistUpdatable.playlist_index = active_playlist()
AND PlaylistUpdatable.item_is_selected
The new functionality of the Send to SQL Console vs. the renamed Execute in SQL console doesn't raise the error I used to get in the previous version when it tried to execute the dummy text and couldn't find the field "READFIELD", which is a nice little plus.