Determines if a struct is declared yet.

The declaration of a struct extends to the entire process execution, and prevails at the end of the XSQL-script in which has been declared. Consequently, if this XSQL-script is recursively called, without taking into account if the struct has been previously declared, through the second iteration will produce an error of struct already defined.

For this reason, it is recommended that all declaration of a susceptible structure to be declared several times in a same execution, will be encapsulated inside of the isDeclared tag.

1 struct.isDeclared

<struct.isDeclared type='type'/>

Exceptions

attribute 'type' required

The struct name has not been specified.

Example

Declaration of a struct, controlling that has not been previously declared.

Copy
<xsql-script name='struct_isDeclared_point2d'>
    <body>
        <if>
            <expr>
                <not><struct.isDeclared type='point2d' /></not>
            </expr>
            <then>
                <struct.declare type='point2d'>
                    <field name='x' type='double' />
                    <field name='y' type='double' />
                </struct.declare>
            </then>
        </if>
    </body>
</xsql-script>