Loading ...
Sorry, an error occurred while loading the content.

Inserting data to different tables

Expand Messages
  • Peter V. Mikhalenko
    Hello! What configuration of maps and actions must I have to insert data from one XML to several different tables? Suppose there is such an XML:
    Message 1 of 2 , Sep 28, 2002
    • 0 Attachment
      Hello!

      What configuration of maps and actions must I have to insert data from one
      XML to several different tables?
      Suppose there is such an XML:
      <message>
      <author>I am</author>
      <body>This is body</body>
      </message>

      and I want an author element to be inserted into "messages" table and
      "threads" table simultaneousely.

      Beforehand thanks.

      __
      Peter V. Mikhalenko
      Lead Developer
      Sigent Interactive Agency
      peter@...
    • rpbourret@rpbourret.com
      This is not supported. A given element or attribute may only be mapped to a single column. That said, an element or attribute value *is* inserted into multiple
      Message 2 of 2 , Oct 14, 2002
      • 0 Attachment
        This is not supported. A given element or attribute may only be mapped to a
        single column.

        That said, an element or attribute value *is* inserted into multiple tables
        when it is used as part of a unique key / foreign key pair used to join two
        tables. For example, suppose the following XML is mapped to the Orders and
        Items tables:

        <Order>
        <SONumber>123</SONumber>
        <CustomerNumber>456</CustomerNumber>
        <Item>
        <ItemNumber>1</ItemNumber>
        <PartNumber>789</PartNumber>
        </Item>
        </Order>

        Orders table: SONumber, CustomerNumber
        Items table: SONumber, ItemNumber, PartNumber

        Now suppose the keys used to join the Orders and Items tables are
        Orders.SONumber and Items.SONumber. In this case, the value of <SONumber> is
        inserted into both tables.

        In your case, this would work only if:

        1) <author> is mapped to a column that is used to join the messages and threads
        tables.

        2) There is a class element that is mapped to the threads table. For example,
        your XML would have to be something like:

        <message>
        <author>I am</author>
        <body>This is body</body>
        <thread />
        </message>

        If the <thread> element did not exist in your XML document, XML-DBMS would not
        know that it was supposed to insert anything into the threads table. Obviously,
        this is a pretty strange way to use XML-DBMS...

        -- Ron

        > What configuration of maps and actions must I have to insert data from one
        > XML to several different tables?
        > Suppose there is such an XML:
        > <message>
        > <author>I am</author>
        > <body>This is body</body>
        > </message>
        >
        > and I want an author element to be inserted into "messages" table and
        > "threads" table simultaneousely.
      Your message has been successfully submitted and would be delivered to recipients shortly.