[Ur] SQL query generation

hao deng denghao8888 at gmail.com
Thu Aug 11 12:08:23 EDT 2011


Read the manual's Sql part carefully, especially 8.4.2 queries.
You can construct sql from those functions and type functions.
The SQL syntax will finally translate to those functions.

This principle applies to xml to. You can use those xml functions to
generate xml, instead of <xml> syntax. (This was told by Adam C. to me
)



On Thu, Aug 11, 2011 at 8:42 AM, Vladimir Shabanov <vshabanoff at gmail.com> wrote:
> 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?
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>



More information about the Ur mailing list