Products | Download | Buy | About Us |
Connect XML-2-DB User's Guide | ||
5(g). Map Constant Rule - <map-const>
Connect XML-2-DB supports storing a constant value into a database table's column. Instead of mapping an XML element's pcdata or an attribute's value into a database column, we can specify a constant value in a rule in the mapping file, and for all inserts into that table corresponding to this map rule, that constant value will be stored in the database column. Similarly, Connect XML-2-DB supports passing a constant value as the value for a parameter of a procedure. The format of the mapping rule, <map-const> that lets you do this is as follows: <!ELEMENT map-const EMPTY> <!ATTLIST map-const element-name CDATA #REQUIRED table-reference CDATA #IMPLIED proc-reference CDATA #IMPLIED column-name CDATA #IMPLIED param-name CDATA #IMPLIED constant-value CDATA #REQUIRED source-datetime-format CDATA #IMPLIED> In the map-const rule, both table-reference and column-name must be provided or both proc-reference and param-name must be provided.
5(gi). Inserting a constant value into a column of a database table
Examples of mapping a constant value to a database table's column are as follows: <!-- "MID-WEST" will be inserted into the REGION column of the table referenced by SoftwareSales --> <map-const element-name="software-sale" table-reference="SoftwareSales" column-name="REGION" constant-value="MID-WEST"> </map-const> <!-- "Mar 10, 2001" will be inserted into the DATE_CREATED column of the table referenced by SoftwareSales --> <map-const element-name="software-sale" table-reference="SoftwareSales" column-name="DATE_CREATED" constant-value="Mar 10, 2001" source-datetime-format="MMM dd, yyyy"> </map-const> 5(gii). Passing a constant as the value of a parameter to a procedure
Examples of mapping a constant value to a parameter of a procedure call are as follows: <!-- SQL Server example --> <map-const element-name="software-sale" proc-reference="AddSoftwareSale" param-name="@i_date_created" constant-value="Mar 10, 2001" source-datetime-format="MMM dd, yyyy"> </map-const> <!-- Oracle example --> <map-const element-name="software-sale" proc-reference="AddSoftwareSale" param-name="I_DATE_CREATED" constant-value="Mar 10, 2001" source-datetime-format="MMM dd, yyyy"> </map-const> |
Copyright © Skyhawk
Systems. All Rights Reserved. Send comments and questions to support@skyhawksystems.com. |