Scott Steinbeck
09/21/2022, 6:31 PM'select *, 1 as ''top'', testCol as "top2" from mytable'
or
"select *, 1 as ""top"", testCol as 'top2' from mytable"
it also can have line breaks in it
"select *,
1 as ""top"",
testCol as 'top2'
from mytable"
I have tried googling it and creating a few additional solutions but none have proven to be the right solution. The reward for will be a new cfml vscode extension to format SQL syntax within cfc’s and cfm pageswebsolete
09/21/2022, 6:43 PMwebsolete
09/21/2022, 6:44 PMScott Steinbeck
09/21/2022, 6:48 PM//from this part of the code
queryExecute('select *, 1 as ''top'', testCol as "top2" from mytable');
//i need to extract
'select *, 1 as ''top'', testCol as "top2" from mytable'
websolete
09/21/2022, 6:48 PMwebsolete
09/21/2022, 6:56 PMScott Steinbeck
09/21/2022, 7:02 PMwebsolete
09/21/2022, 7:03 PMScott Steinbeck
09/21/2022, 7:03 PMRodney
09/21/2022, 7:03 PMwebsolete
09/21/2022, 7:04 PMwebsolete
09/21/2022, 7:04 PMScott Steinbeck
09/21/2022, 7:04 PMScott Steinbeck
09/21/2022, 7:05 PMRodney
09/21/2022, 7:05 PMScott Steinbeck
09/21/2022, 7:06 PMwebsolete
09/21/2022, 7:07 PMScott Steinbeck
09/21/2022, 7:07 PMRodney
09/21/2022, 7:07 PMTim
09/21/2022, 7:08 PMScott Steinbeck
09/21/2022, 7:08 PMScott Steinbeck
09/21/2022, 7:09 PMTim
09/21/2022, 7:10 PMScott Steinbeck
09/21/2022, 7:11 PMwebsolete
09/21/2022, 7:12 PMRodney
09/21/2022, 7:13 PMwebsolete
09/21/2022, 7:13 PMwebsolete
09/21/2022, 7:13 PMwebsolete
09/21/2022, 7:13 PMwebsolete
09/21/2022, 7:14 PMRodney
09/21/2022, 7:14 PMsql = "SELECT * FROM " & table & " WHERE id = :id"
websolete
09/21/2022, 7:16 PMwebsolete
09/21/2022, 7:16 PMhttps://www.websolete.com/wp-content/uploads/2019/09/7_procschema.png▾
websolete
09/21/2022, 7:17 PMwebsolete
09/21/2022, 7:17 PMScott Steinbeck
09/21/2022, 7:41 PMScott Steinbeck
09/21/2022, 7:47 PMSELECT CASE WHEN supplimental.ogc_fid=1 THEN 'Supplimental' ELSE 'Primary' END AS TYPE,round(SUM (apn_acres) :: NUMERIC,2) FROM apn LEFT JOIN supplimental ON st_intersects (ST_SetSRID (supplimental.wkb_geometry,3857),apn.wkb_geometry) GROUP BY supplimental.ogc_fid
to something like this
SELECT
CASE
WHEN
supplimental.ogc_fid = 1 THEN
'Supplimental' ELSE'Primary'
END AS TYPE,
round( SUM ( apn_acres ) :: NUMERIC, 2 )
FROM
apn
LEFT JOIN supplimental ON st_intersects (
ST_SetSRID ( supplimental.wkb_geometry, 3857 ),
apn.wkb_geometry
)
GROUP BY
supplimental.ogc_fid
using an NPM module called https://github.com/sql-formatter-org/sql-formatter
so to accomplish this i need to find SQL strings in your current document and pass them to the formatter, then replace the unformatted code with formatted