quicktemplate icon indicating copy to clipboard operation
quicktemplate copied to clipboard

make it be a sql template

Open fxk2006 opened this issue 6 years ago • 1 comments

hi,I want make it be a best sql template like this: step1: define a sql template text select * from table where name=#name @if age>0 { and age=#age or name=#name @}

step2: when I give one param "name" with value "John",after call your quilktemplate,return a preparedstatment string sql, and a paramslist select * from table where name=? , [ John]

when I give two params "name=John" and "age=12",it should be like this:

select * from table where name=? and age=? or name=?, [John, 12, John]

I think it should be very usefull. thanks

fxk2006 avatar Oct 22 '19 05:10 fxk2006

@fxk2006 Have you tried sqlc ? It does this kind of thing but with many more useful features

andys avatar Dec 30 '21 22:12 andys