Print to a file the result of a query.
 

1 file.writer.print.sql

<file.writer.print.sql
    id='id'
    head='head'
>
    <nativesql> ?
        <sql_query /> !
    </nativesql>
    <select> ?
        <columns> !
            <column /> +
        </columns>
        <from> !
            <join> *
                <on /> +
            </join>
        </from>
        <where> ?
            <conditions /> +
        </where>
        <group> ?
            <idx_columns_to_group_query /> +
        </group>
        <having> ?
            <idx_columns_to_having_query /> +
        </having>
        <order> ?
            <idx_columns_to_order_query /> +
        </order>
    </select>
    <union> ?
        <select> +
            <[...] /> !
        </select>
    </union>
</file.writer.print.sql>
Example

Print to a file the result of a query. The result has the following form:

Copy
<xsql-script name='file_writer_print_sql_sample1'>
    <body>
        <set name='m_file'>
            <string>c:<file.separator />source<file.separator />deister.txt</string>
        </set>
        <file.writer.open id='out1'>
            <file name='#m_file' type='absolute' />
        </file.writer.open>
        <file.writer.print.sql id='out1'>
            <select>
                <columns>*</columns>
                <from table='people' />
            </select>
        </file.writer.print.sql>
        <file.writer.close id='out1' />
    </body>
</xsql-script>

The file contains the result:

Copy
+---------+-----------+----------+---------+-----------------------+
|dni      |name       |surname1  |surname2 |birth date             |
+---------+-----------+----------+---------+-----------------------+
|44018656Z|David      |Valls     |Teixidó  |1978-06-03             |
|47717626D|Josep      |Gonzalez  |Fuxet    |1981-01-14             |
|40994810R|Fernando   |Villalonga|Martínez |1978-05-23             |
|X4957019J|Jose Manuel|Luque     |Giannetto|1972-03-03             |
+---------+-----------+----------+---------+-----------------------+