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>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aid | string | Identifier of the file. | |||
Ahead | boolean | Indicates if a header with the names of the columns should be showed. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Enativesql | |||||
Esql_query | string | ||||
Eselect | |||||
Ecolumns | |||||
Ecolumn | string | ||||
Efrom | |||||
Ejoin | |||||
Eon | |||||
Ewhere | |||||
Econditions | string | ||||
Egroup | |||||
Eidx_columns_to_group_query | string | ||||
Ehaving | |||||
Eidx_columns_to_having_query | string | ||||
Eorder | |||||
Eidx_columns_to_order_query | string | ||||
Eunion | |||||
Eselect | |||||
E[...] |
Returns | |
---|---|
Type | Description |
null |
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 | +---------+-----------+----------+---------+-----------------------+