Convert an object to an array.
 

1 array.fromArray

<array.fromArray name='name'>
    <Object /> +
</array.fromArray>
Example

Converts an object of array type to another array.

Copy
<xsql-script name='test_array_fromArray'>
  <body>
    <println>
        <string>Array a</string>
        <array.toResultSet>
            <array.fromArray name='cities'>
                <array>
                    <string>Barcelona</string>
                    <string>Madrid</string>
                    <string>Valencia</string>
                </array> 
            </array.fromArray>
        </array.toResultSet>
                <string>Array b</string>
        <array.toResultSet>
            <array.fromArray name='cities'>
                <array>
                    <string>[Barcelona, Madrid, Valencia]</string>
                </array> 
            </array.fromArray>
        </array.toResultSet>
    </println>
  </body>
</xsql-script>

Show the following result:

Copy
Array a
            
+---------+
|col1     |
+---------+
|Barcelona|
|Madrid   |
|Valencia |
+---------+

            Array b
            
+-----------------------------+
|col1                         |
+-----------------------------+
|[Barcelona, Madrid, Valencia]|
+-----------------------------+
Example

Another example showing the differences:

Copy
<xsql-script name='test1_array_fromArray'>
  <body>
    <array name ='cities'>
        <string>Barcelona</string>
        <string>Madrid</string>
        <string>Valencia</string>
    </array>   
    <println>
        <string>Array a</string>
        <cities />
        
        <string>Array b</string>
        <array.fromArray>    
            <cities />
        </array.fromArray>
    </println>
  </body>
</xsql-script>

Shows the result:

Copy
Array a
[Barcelona,Madrid,Valencia]
        
Array b
[[Barcelona,Madrid,Valencia]]