[Ur] SQL query generation

Vladimir Shabanov vshabanoff at gmail.com
Thu Aug 11 11:42:41 EDT 2011


Ur allows us to generate any part of XML using
    <xml>{...}</xml>.

But with SQL only variable values can be specified:
    SELECT ... WHERE id = {[id]}

Is is possible to extend Ur to support generation of SQL expressions?
E.g. something like
   SELECT ...
   ORDER BY column {if descending then DESC else ASC}
or
   SELECT ...
   WHERE column1 > {[val1]}
       {if filtering then {AND col2 = x} else {}}

I need to make some queries which are largely the same but differs in
sorting order and/or have additional conditions. Currently I need to
copy&paste all the query and change few lines of code. Maybe there is
a better solution?



More information about the Ur mailing list