The RDBMSResolver component (Flash Professional only)

The RDBMSResolver component creates an XML packet that can be sent to an external data source (such as ASP/JSP page, servlet, and so on). The XML packet can easily be translated into SQL statements that can be used to update any standard SQL relational database

Note: You can use the RDBMSResolver component to send data updates to any external data source that can parse XML and generate SQL statements against a database —for example, an ASP page, a Java servlet, or a ColdFusion component.

The RDBMSResolver component works only with Flash Player 7.

RDBMSResolver component parameters

The following are the RDBMSResolver component parameters:

tableName The table name put in the XML for the DB table that should be updated. This should be the same as the value input for any fieldInfo items (or they should be blank) for any fields that should be updated.

updateMode This parameter has several values that determine the way key fields are identified when the XML update packet is being generated, as follows:

nullValue The value put in a field's value to indicate a null value. This is customizable to prevent it from being confused with an empty string ("") or another valid value.

fieldInfo If your data source is a database table, then it should have one or more key fields that uniquely identify a record within a table. Additionally, there may be fields that have been calculated or joined from another table. Those fields must be identified so that key fields can be set within the XML update packet, and fields that should not be updated are left out of the XML update packet.

The RDBMSResolver component provides a fieldInfo parameter for this purpose. This parameter allows you to define an unlimited number of fields that require special handling. Each fieldInfo item contains three properties:

Common workflow for the RDBMSResolver component

The typical workflow for the RDBMSResolver component is as follows.

To use an RDBMSResolver component:

  1. Add two instances of the WebServicesConnector component and one instance each of the DataSet and RDBMSResolver components to your application and give them instance names.
  2. Select the first WebServicesConnector component and use the Parameters tab of the Component Inspector panel to enter the WSDLURL for a web service that exposes data from an external data source.

    Note: The web service must return an array of records to be bound to the data set.

  3. Use the Bindings tab of the Component Inspector panel to bind the WebServicesConnector component to the DataSet component.
  4. Select the DataSet component, and use the Bindings tab of the Component Inspector panel to bind data elements (DataSet fields) to the visual components in your application.
  5. Bind the DataSet component to the RDBMSResolver component.

    Note: The update instructions are sent from the DataSet component to the RDBMSResolver component when the applyUpdates method of the DataSet component is called.

  6. Select the RDBMSResolver component and bind it to the second WebServiceConnector component to send the data back to your external data source.
  7. Add a trigger to initiate the data binding operation: use the Trigger Data Source behavior attached to a button, or add ActionScript.

    Note: In addition to these steps, you an also create bindings to apply the result packet sent back from the server to the DataSet component via the RDBMSResolver component.

    For more information, see RDBMSResolver component.

About sending updates to an external data source

The XML update packet contains three different types of nodes: delete, insert, and update. Each of these nodes represents a change to a row in a database table. Each node contains field nodes that locate a record to update and describe the modifications made, if any.

The updates sent from a resolver component are in the form of an XML update packet that is sent to an external data source via a connector component. The following is an example of an RDBMSResolver component's XML update packet generated with updateMode parameter set to umUsingKey:

<update_packet tableName="customers" nullValue="{_NULL_}" transID="46386292065:Wed Jun 25 15:52:34 GMT-0700 2003">
      <delete id="11295627477">
         <field name="id" type="numeric" oldValue="10" key="true"/> 
      </delete>
      <insert id="12345678901">
         <field name="id" type="numeric" newValue="20" key="true"/>  
         <field name="firstName" type="string" newValue="Davey" key="false"/> 
         <field name="lastName" type="string" newValue="Jones" key="false"/> 
      </insert>
      <update id="98765432101"> <field name="id" type="numeric" oldValue="30" key="true"/>
         <field name="firstName" type="string" oldValue="Peter" newValue="Mickey" key="false"/> 
         <field name="lastName" type="string" oldValue="Tork" newValue="Dolenz" key="false"/> 
      </update>
   </update_packet>

Elements in the XML update packet include the following:

The following table describes how the key attributes value is determined. If a field is defined as a key field, using the RDBMSResolver component's fieldInfo parameter, it will always appear in the update packet with key="true". Otherwise, the field's key attribute in the update packet will be set according to the following table:

Node type

umUsingKey

umUsingModified

umUsingAll

delete

false

true

true

insert

false

true

false

update

false

true if the field was modified, false otherwise

true

About receiving results from an external data source

Once the server has finished with the update packet, either successfully or unsuccessfully, it should send back a result packet containing errors or additional updates resulting from the update operation. If there are no messages, the results packet should still be sent, but it will have no operation result nodes.

The following is a sample RDBMSResolver component results packet (with both update results and change information nodes):

<results_packet nullValue="{_NULL_}" transID="46386292065:Wed Jun 25 15:52:34 GMT-0700 2003"> 
      <operation op="delete" id="11295627479" msg="The record could not be found"/> 
      <delete> 
         <field name="id" oldValue="1000" key="true" /> 
      </delete> 
      <insert> 
         <field name="id" newValue="20"/> 
         <field name="firstName" newValue="Davey"/>  
         <field name="lastName" newValue="Jones"/> 
      </insert>  
      <operation op="update" id="02938027477" msg="Couldn't update employee."> 
         <field name="id" curValue="105" msg="Invalid field value" /> 
      </operation> 
      <update>  
         <field name="id" oldValue="30" newValue="30" key="true" /> 
         <field name="firstName" oldValue="Peter" newValue="Mickey"/> 
         <field name="lastName" oldValue="Tork" newValue="Dolenz"/> 
      </update> 
   </results_packet>

The results packet contains four different types of nodes: