1 table.build
Release 2017.3
Tag available since version 2017.3.
Builds a table on the database where the execution is done with the result of the query grid and returns its name to use on a new query.
<table.build
name='name'
temp='temp'
>
<resultSet /> !
</table.build>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aname | string | The name of the table. If the table is temporary the name is autogenerated using the provided pattern. | |||
Atemp | boolean | true | Indicates if the table is temporary or static. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
EresultSet | ResultSet | The result set obtained from select.grid. |
Returns | |
---|---|
Type | Description |
String | Returns the name of the new table. |
Example
Copy
<xsql-script> <body> <connection name='sysmaster1'> <set name='rs'> <!-- Run a multi database query, returning a memory result set. --> <!-- Each db has it's pool configuration timeout but can be owerride via timeout !=0 --> <select.grid name='grid_demo' timeout='30'> <columns>tabname, nrows, npused</columns> <from table='systables' /> <where>tabname LIKE 'capuntes%'</where> </select.grid> </set> </connection> <set name='tabname'> <table.build name='tmpgrid'><rs/></table.build> </set> <println>... The name of the new temporary table is: <tabname /></println> <print.sql> <select> <columns>*</columns> <from table='${tabname}' /> </select> </print.sql> </body> </xsql-script>
... The name of the new temporary table is: tmpgrid_94952
+----------------------------------------+----------------+----------------+----------------------------------------+----------------------------------------+
|tabname |nrows |npused |grid_node |grid_error |
|varchar |decimal |decimal |char |char |
+----------------------------------------+----------------+----------------+----------------------------------------+----------------------------------------+
|capuntes | 7887.0000| 1604.0000|demo_sports | |
|capuntes | 442028.0000| 89265.0000|demo_industria | |
|capuntes | 4557441.0000| 955229.0000|demo_cons | |
+----------------------------------------+----------------+----------------+----------------------------------------+----------------------------------------+