Manipulating Data in the ESRI Database

In this section:

In addition to inserting geocoding data, the police department can also manipulate existing crime data in the ESRI database. Using the iWay Technology Adapter for ESRI, they can query, update, or delete information. The following section provides examples of XML request and response documents to perform an update, a query, and a delete to crime information.


Top of page

x
Update Request Document

The police department has revised the names they use to identify crimes and must update the ESRI database to reflect this. They want to rename theft to robbery.

The following XML update request document is created to perform this task. The <where> condition identifies the record in the database to be updated, CRIMEID 1111. The data between the <record> tags contains the data about CRIMEID 1111, including the new description of 'Robbery', <CRIMEDESC>Robbery</CRIMEDESC>.

<arcsde_CRIME_update_request
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:\Temp\update_request.xsd">
     <record>
        <CRIMEID>1111</CRIMEID>
        <CRIMEDESC>Robbery</CRIMEDESC>
        <TLOCATION>
            <lon>3.1415926</lon>
            <lat>3.1415926</lat>
        </TLOCATION>
        <CRIMEDATE>08-13-1967 2:22:22</CRIMEDATE>
    </record>
    <where>CRIMEID=1111</where>
</arcsde_CRIME_update_request>

Top of page

x
Update Response Document

When the update is complete, an update response document is returned to the adapter. As shown in the following response document, the <Return_Msg>OK</Return_Msg> statement verifies that the record was updated, and the <update_recordsNumber>1</update_recordsNumber> statement verifies that one record was update.

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <SOAP-ENV:Body>
     <updateResponse
         xmlns="urn:iwaysoftware:ibse:jul2003:update:response"
         cid="9E04550FC76A09F4CA8730D7B3353EDD">
       <arcsde_update_response>
          <Return_Code>0</Return_Code>
          <Return_Msg>OK</Return_Msg>
          <update_recordsNumber>1</update_recordsNumber>
       </arcsde_update_response>
     </updateResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Top of page

x
Query Request Document

The query request document retrieves a piece of information from the ESRI database. For example, this query request document asks for the crime description of the crime with ID 1111 using the <querycolumn>crimedesc</querycolumn> and <where>crimeid=1111</where> statements.

<?xml version="1.0" encoding="UTF-8"?>
  <!--Sample XML file generated by XMLSPY v5 rel. 4 U
      (http://www.xmlspy.com)-->
    <arcsde_CRIME_query_request
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation="C:\Temp\query_request.xsd"
       <querycolumn>crimedesc</querycolumn>
       <where>crimeid=1111</where>
    </arcsde_CRIME_query_request>

Top of page

x
Query Response Document

The query response document includes the requested information. The following query response document shows that the description for crime ID 1111 is a robbery using the <crimedesc>Robbery</crimedesc> statement.

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/
          xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <SOAP-ENV:Body>
     <QueryResponse xmlns="urn:iwaysoftware:ibse:jul2003:Query:response"
                          cid="30ACF12D7DA3C1A8285A17D090DD15CD">
       <arcsde_query_response>
         <Return_Code>0</Return_Code>
         <Return_Msg>OK</Return_Msg> 
         <insert_recordsNumber>1</insert_recordsNumber>
            <record>
               <crimedesc>Robbery</crimedesc>
            </record>
       </arcsde_query_response>
    </QueryResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Top of page

x
Delete Request Document

If the police department wants to delete a record, they create an XML delete request document. In the following XML delete request document, they want to delete the record with CRIMEID 111, identified in the <where>CRIMEID=1111</where> statement.

<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSPY v5 rel. 4 U
    (http://www.xmlspy.com)-->
<arcsde_CRIME_delete_request
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="C:\Temp\delete_request.xsd">
  <where>CRIMEID=1111</where>
</arcsde_CRIME_delete_request>

Top of page

x
Delete Response Document

When the delete is completed, the following response document is sent to the adapter. The <Return_Msg>OK</Return_Msg> statement indicates that the delete was successful.

<?xml version="1.0" encoding="UTF-8" ?>
  <SOAP-ENV:Envelope
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <SOAP-ENV:Body>
        <DeleteResponse
              xmlns="urn:iwaysoftware:ibse:jul2003:Delete:response"
              cid="7E32FFBC27F6C7C80973C016D197150C">
          <arcsde_delete_response>
             <Return_Code>0</Return_Code>
             <Return_Msg>OK</Return_Msg>
          </arcsde_delete_response>
       </DeleteResponse>
    </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>

iWay Software