This tag resolves the conflict of quotation marks within a text and also solves the problem of using dates through the appropriate function depending on the database agent.

1 variable.toQuery

<variable.toQuery>
    <var /> !
</variable.toQuery>

Exceptions

requires 1 arguments, received: [...]

Wrong number of arguments specified

Example

Convert a variable to the query string format

Copy
<xsql-script name='variable_toQuery_sample1'>
    <body>
        <set name='a'>select * from wic_jrep_object</set>
        <println> <variable.toQuery><a/></variable.toQuery></println>
    </body>
</xsql-script>
Example

Quote conflict resolution within a text and example of a variable type DATE.

Copy
<xsql-script name='variable_toQuery_sample_quote'>
   <body>
       <set name='a'>abc ' def</set>
       <println> <variable.toQuery><a/></variable.toQuery></println>
       <set name='a'><add><string>fecini = </string><variable.toQuery><date.today/></variable.toQuery></add></set>
       <println> <a/></println>
   </body>

</xsql-script>

Result for Informix:

Copy
'abc '' def'
fecini = MDY(8,8,2013)

Result for Oracle:

Copy
'abc '' def'
fecini = TO_DATE(20130808, 'yyyymmdd')

Result for postgresql:

Copy
'abc '' def'
fecini = TO_DATE(20130808, 'yyyymmdd')