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

Re: [xml-dbms] Re: Filter question

Expand Messages
  • Ronald Bourret
    Cool! I d never thought about this, but you ve managed to put XML-DBMS into an infinite loop, which would explain the stack overflow error. To solve this,
    Message 1 of 7 , Jun 24, 2005
    • 0 Attachment
      Cool! I'd never thought about this, but you've managed to put XML-DBMS
      into an infinite loop, which would explain the stack overflow error. To
      solve this, remove the RelatedClass element (and its children) from the
      ClassMap for item (TEST_ITEM table).

      Basically, RelatedClass says to include another "class" element inside
      the current "class" element. You only need to add a RelatedClass element
      to the ClassMap of the parent element type -- in your case, the order
      element type.

      So while your ClassMap for the order element type correctly says that it
      should include one or more item elements, your ClassMap for the item
      element type incorrectly says that it should include an order element.
      In other words, you're trying to construct the following XML document:

      <order>
      ...
      <item>
      ...
      <order>
      ...
      <item>
      ...

      Because XML-DBMS continually joins the orders table to the items table
      on the order ID and vice versa, this process never ends.

      One other comment is that you probably don't want a PropertyMap for the
      ORDER_ID column in the ClassMap for item. This will repeat the order ID
      in each item element, which is redundant, since the order ID is already
      a child element of the order element.

      -- Ron

      sctt_bainbridge wrote:
      > Hi,
      >
      > the map is:
      >
      > <?xml version='1.0' ?>
      >
      > <!DOCTYPE XMLToDBMS SYSTEM "xmldbms2.dtd" >
      >
      > <XMLToDBMS Version="2.0"
      > xmlns="http://www.xmlmiddleware.org/xmldbms/v2">
      > <Options>
      > <SimpleDateFormat Pattern="yyyy-mm-dd"
      > DefaultForTypes="DATE" />
      > </Options>
      > <Databases>
      > <Database>
      > <Catalog>
      > <Schema>
      > <Table Name="TEST_CUSTOMER">
      > <Column Name="CUSTOMER_ID" DataType="INTEGER"
      > Length="6" Nullable="No"/>
      > <Column Name="CUSTOMER_NAME" DataType="VARCHAR"
      > Length="50" Nullable="Yes"/>
      > <Column Name="STREET" DataType="VARCHAR"
      > Length="150" Nullable="Yes"/>
      > <Column Name="CITY" DataType="VARCHAR"
      > Length="50" Nullable="Yes"/>
      > <Column Name="STATE" DataType="VARCHAR"
      > Length="50" Nullable="Yes"/>
      > <Column Name="POST_CODE" DataType="VARCHAR"
      > Length="4" Nullable="Yes"/>
      > <PrimaryKey>
      > <UseColumn Name="CUSTOMER_ID"
      > KeyGenerator="Database"/>
      > </PrimaryKey>
      > </Table>
      > <Table Name="TEST_ORDER">
      > <Column Name="ORDER_ID" DataType="INTEGER"
      > Length="6" Nullable="No"/>
      > <Column Name="ORDER_TITLE" DataType="VARCHAR"
      > Length="50" Nullable="Yes"/>
      > <Column Name="CUSTOMER_ID" DataType="INTEGER"
      > Length="6" Nullable="No"/>
      > <Column Name="ORDER_DATE" DataType="DATE"
      > Nullable="No"/>
      > <PrimaryKey>
      > <UseColumn Name="ORDER_ID"/>
      > </PrimaryKey>
      > <ForeignKey Name="FK_CUSTOMER">
      > <UseTable Name="TEST_CUSTOMER" />
      > <UseUniqueKey Name="PrimaryKey" />
      > <UseColumn Name="CUSTOMER_ID"/>
      > </ForeignKey>
      > </Table>
      > <Table Name="TEST_ITEM">
      > <Column Name="ITEM_ID" DataType="INTEGER"
      > Nullable="No"/>
      > <Column Name="ORDER_ID" DataType="INTEGER"
      > Nullable="No"/>
      > <Column Name="ITEM_DESCRIPTION"
      > DataType="VARCHAR" Length="150" Nullable="Yes"/>
      > <Column Name="ITEM_PRICE" DataType="DOUBLE"
      > Nullable="No"/>
      > <Column Name="ITEM_QUANTITY" DataType="INTEGER"
      > Length="6" Nullable="No"/>
      > <PrimaryKey>
      > <UseColumn Name="ORDER_ID"/>
      > <UseColumn Name="ITEM_ID"
      > KeyGenerator="Database"/>
      > </PrimaryKey>
      > <ForeignKey Name="FK_ORDER">
      > <UseTable Name="TEST_ORDER" />
      > <UseUniqueKey Name="PrimaryKey" />
      > <UseColumn Name="ORDER_ID"/>
      > </ForeignKey>
      > </Table>
      > </Schema>
      > </Catalog>
      > </Database>
      > </Databases>
      > <Maps>
      > <ClassMap>
      > <ElementType Name="customer"/>
      > <ToClassTable Name="TEST_CUSTOMER"/>
      > <PropertyMap>
      > <ElementType Name="customerid"/>
      > <ToColumn Name="CUSTOMER_ID"/>
      > </PropertyMap>
      > <PropertyMap>
      > <ElementType Name="custname"/>
      > <ToColumn Name="CUSTOMER_NAME"/>
      > </PropertyMap>
      > <PropertyMap>
      > <ElementType Name="street"/>
      > <ToColumn Name="STREET"/>
      > </PropertyMap>
      > <PropertyMap>
      > <ElementType Name="city"/>
      > <ToColumn Name="CITY"/>
      > </PropertyMap>
      > <PropertyMap>
      > <ElementType Name="state"/>
      > <ToColumn Name="STATE"/>
      > </PropertyMap>
      > <PropertyMap>
      > <ElementType Name="postcode"/>
      > <ToColumn Name="POST_CODE"/>
      > </PropertyMap>
      > </ClassMap>
      > <ClassMap>
      > <ElementType Name="order"/>
      > <ToClassTable Name="TEST_ORDER"/>
      > <PropertyMap>
      > <ElementType Name="id"/>
      > <ToColumn Name="ORDER_ID"/>
      > </PropertyMap>
      > <PropertyMap>
      > <ElementType Name="title"/>
      > <ToColumn Name="ORDER_TITLE"/>
      > </PropertyMap>
      > <PropertyMap>
      > <ElementType Name="customerid"/>
      > <ToColumn Name="CUSTOMER_ID"/>
      > </PropertyMap>
      > <PropertyMap>
      > <ElementType Name="orderdate"/>
      > <ToColumn Name="ORDER_DATE"/>
      > </PropertyMap>
      > <RelatedClass KeyInParentTable="Foreign">
      > <ElementType Name="customer"/>
      > <UseUniqueKey Name="PrimaryKey"/>
      > <UseForeignKey Name="FK_CUSTOMER"/>
      > </RelatedClass>
      > <RelatedClass KeyInParentTable="Unique">
      > <ElementType Name="item"/>
      > <UseUniqueKey Name="PrimaryKey"/>
      > <UseForeignKey Name="FK_ORDER"/>
      > <OrderColumn Name="ITEM_ID" Direction="Ascending" />
      > </RelatedClass>
      > </ClassMap>
      > <ClassMap>
      > <ElementType Name="item"/>
      > <ToClassTable Name="TEST_ITEM"/>
      > <PropertyMap>
      > <ElementType Name="itemid"/>
      > <ToColumn Name="ITEM_ID"/>
      > </PropertyMap>
      > <PropertyMap>
      > <ElementType Name="id"/>
      > <ToColumn Name="ORDER_ID"/>
      > </PropertyMap>
      > <PropertyMap>
      > <ElementType Name="description"/>
      > <ToColumn Name="ITEM_DESCRIPTION"/>
      > </PropertyMap>
      > <PropertyMap>
      > <ElementType Name="price"/>
      > <ToColumn Name="ITEM_PRICE"/>
      > </PropertyMap>
      > <PropertyMap>
      > <ElementType Name="quantity"/>
      > <ToColumn Name="ITEM_QUANTITY"/>
      > </PropertyMap>
      > <RelatedClass KeyInParentTable="Foreign">
      > <ElementType Name="order"/>
      > <UseUniqueKey Name="PrimaryKey"/>
      > <UseForeignKey Name="FK_ORDER"/>
      > </RelatedClass>
      > </ClassMap>
      > </Maps>
      > </XMLToDBMS>
      >
      > I still think this is somehow bound up in the relationship between
      > the tables and the keys used to relate them...
      >
      > Again thanks for any help.
      >
      >
      > Scott.
    • sctt_bainbridge
      Thanks!! That seems to have fixed it and now it all works - again many many thanks for helping me. Cheers, Scott. ... DBMS ... error. To ... from the ...
      Message 2 of 7 , Jun 26, 2005
      • 0 Attachment
        Thanks!! That seems to have fixed it and now it all works - again
        many many thanks for helping me.

        Cheers,



        Scott.

        --- In xml-dbms@yahoogroups.com, Ronald Bourret <rpbourret@r...>
        wrote:
        > Cool! I'd never thought about this, but you've managed to put XML-
        DBMS
        > into an infinite loop, which would explain the stack overflow
        error. To
        > solve this, remove the RelatedClass element (and its children)
        from the
        > ClassMap for item (TEST_ITEM table).
        >
        > Basically, RelatedClass says to include another "class" element
        inside
        > the current "class" element. You only need to add a RelatedClass
        element
        > to the ClassMap of the parent element type -- in your case, the
        order
        > element type.
        >
        > So while your ClassMap for the order element type correctly says
        that it
        > should include one or more item elements, your ClassMap for the
        item
        > element type incorrectly says that it should include an order
        element.
        > In other words, you're trying to construct the following XML
        document:
        >
        > <order>
        > ...
        > <item>
        > ...
        > <order>
        > ...
        > <item>
        > ...
        >
        > Because XML-DBMS continually joins the orders table to the items
        table
        > on the order ID and vice versa, this process never ends.
        >
        > One other comment is that you probably don't want a PropertyMap
        for the
        > ORDER_ID column in the ClassMap for item. This will repeat the
        order ID
        > in each item element, which is redundant, since the order ID is
        already
        > a child element of the order element.
        >
        > -- Ron
        >
        > sctt_bainbridge wrote:
        > > Hi,
        > >
        > > the map is:
        > >
        > > <?xml version='1.0' ?>
        > >
        > > <!DOCTYPE XMLToDBMS SYSTEM "xmldbms2.dtd" >
        > >
        > > <XMLToDBMS Version="2.0"
        > > xmlns="http://www.xmlmiddleware.org/xmldbms/v2">
        > > <Options>
        > > <SimpleDateFormat Pattern="yyyy-mm-dd"
        > > DefaultForTypes="DATE" />
        > > </Options>
        > > <Databases>
        > > <Database>
        > > <Catalog>
        > > <Schema>
        > > <Table Name="TEST_CUSTOMER">
        > > <Column Name="CUSTOMER_ID" DataType="INTEGER"
        > > Length="6" Nullable="No"/>
        > > <Column Name="CUSTOMER_NAME"
        DataType="VARCHAR"
        > > Length="50" Nullable="Yes"/>
        > > <Column Name="STREET" DataType="VARCHAR"
        > > Length="150" Nullable="Yes"/>
        > > <Column Name="CITY" DataType="VARCHAR"
        > > Length="50" Nullable="Yes"/>
        > > <Column Name="STATE" DataType="VARCHAR"
        > > Length="50" Nullable="Yes"/>
        > > <Column Name="POST_CODE" DataType="VARCHAR"
        > > Length="4" Nullable="Yes"/>
        > > <PrimaryKey>
        > > <UseColumn Name="CUSTOMER_ID"
        > > KeyGenerator="Database"/>
        > > </PrimaryKey>
        > > </Table>
        > > <Table Name="TEST_ORDER">
        > > <Column Name="ORDER_ID" DataType="INTEGER"
        > > Length="6" Nullable="No"/>
        > > <Column Name="ORDER_TITLE" DataType="VARCHAR"
        > > Length="50" Nullable="Yes"/>
        > > <Column Name="CUSTOMER_ID" DataType="INTEGER"
        > > Length="6" Nullable="No"/>
        > > <Column Name="ORDER_DATE" DataType="DATE"
        > > Nullable="No"/>
        > > <PrimaryKey>
        > > <UseColumn Name="ORDER_ID"/>
        > > </PrimaryKey>
        > > <ForeignKey Name="FK_CUSTOMER">
        > > <UseTable Name="TEST_CUSTOMER" />
        > > <UseUniqueKey Name="PrimaryKey" />
        > > <UseColumn Name="CUSTOMER_ID"/>
        > > </ForeignKey>
        > > </Table>
        > > <Table Name="TEST_ITEM">
        > > <Column Name="ITEM_ID" DataType="INTEGER"
        > > Nullable="No"/>
        > > <Column Name="ORDER_ID" DataType="INTEGER"
        > > Nullable="No"/>
        > > <Column Name="ITEM_DESCRIPTION"
        > > DataType="VARCHAR" Length="150" Nullable="Yes"/>
        > > <Column Name="ITEM_PRICE" DataType="DOUBLE"
        > > Nullable="No"/>
        > > <Column Name="ITEM_QUANTITY"
        DataType="INTEGER"
        > > Length="6" Nullable="No"/>
        > > <PrimaryKey>
        > > <UseColumn Name="ORDER_ID"/>
        > > <UseColumn Name="ITEM_ID"
        > > KeyGenerator="Database"/>
        > > </PrimaryKey>
        > > <ForeignKey Name="FK_ORDER">
        > > <UseTable Name="TEST_ORDER" />
        > > <UseUniqueKey Name="PrimaryKey" />
        > > <UseColumn Name="ORDER_ID"/>
        > > </ForeignKey>
        > > </Table>
        > > </Schema>
        > > </Catalog>
        > > </Database>
        > > </Databases>
        > > <Maps>
        > > <ClassMap>
        > > <ElementType Name="customer"/>
        > > <ToClassTable Name="TEST_CUSTOMER"/>
        > > <PropertyMap>
        > > <ElementType Name="customerid"/>
        > > <ToColumn Name="CUSTOMER_ID"/>
        > > </PropertyMap>
        > > <PropertyMap>
        > > <ElementType Name="custname"/>
        > > <ToColumn Name="CUSTOMER_NAME"/>
        > > </PropertyMap>
        > > <PropertyMap>
        > > <ElementType Name="street"/>
        > > <ToColumn Name="STREET"/>
        > > </PropertyMap>
        > > <PropertyMap>
        > > <ElementType Name="city"/>
        > > <ToColumn Name="CITY"/>
        > > </PropertyMap>
        > > <PropertyMap>
        > > <ElementType Name="state"/>
        > > <ToColumn Name="STATE"/>
        > > </PropertyMap>
        > > <PropertyMap>
        > > <ElementType Name="postcode"/>
        > > <ToColumn Name="POST_CODE"/>
        > > </PropertyMap>
        > > </ClassMap>
        > > <ClassMap>
        > > <ElementType Name="order"/>
        > > <ToClassTable Name="TEST_ORDER"/>
        > > <PropertyMap>
        > > <ElementType Name="id"/>
        > > <ToColumn Name="ORDER_ID"/>
        > > </PropertyMap>
        > > <PropertyMap>
        > > <ElementType Name="title"/>
        > > <ToColumn Name="ORDER_TITLE"/>
        > > </PropertyMap>
        > > <PropertyMap>
        > > <ElementType Name="customerid"/>
        > > <ToColumn Name="CUSTOMER_ID"/>
        > > </PropertyMap>
        > > <PropertyMap>
        > > <ElementType Name="orderdate"/>
        > > <ToColumn Name="ORDER_DATE"/>
        > > </PropertyMap>
        > > <RelatedClass KeyInParentTable="Foreign">
        > > <ElementType Name="customer"/>
        > > <UseUniqueKey Name="PrimaryKey"/>
        > > <UseForeignKey Name="FK_CUSTOMER"/>
        > > </RelatedClass>
        > > <RelatedClass KeyInParentTable="Unique">
        > > <ElementType Name="item"/>
        > > <UseUniqueKey Name="PrimaryKey"/>
        > > <UseForeignKey Name="FK_ORDER"/>
        > > <OrderColumn Name="ITEM_ID"
        Direction="Ascending" />
        > > </RelatedClass>
        > > </ClassMap>
        > > <ClassMap>
        > > <ElementType Name="item"/>
        > > <ToClassTable Name="TEST_ITEM"/>
        > > <PropertyMap>
        > > <ElementType Name="itemid"/>
        > > <ToColumn Name="ITEM_ID"/>
        > > </PropertyMap>
        > > <PropertyMap>
        > > <ElementType Name="id"/>
        > > <ToColumn Name="ORDER_ID"/>
        > > </PropertyMap>
        > > <PropertyMap>
        > > <ElementType Name="description"/>
        > > <ToColumn Name="ITEM_DESCRIPTION"/>
        > > </PropertyMap>
        > > <PropertyMap>
        > > <ElementType Name="price"/>
        > > <ToColumn Name="ITEM_PRICE"/>
        > > </PropertyMap>
        > > <PropertyMap>
        > > <ElementType Name="quantity"/>
        > > <ToColumn Name="ITEM_QUANTITY"/>
        > > </PropertyMap>
        > > <RelatedClass KeyInParentTable="Foreign">
        > > <ElementType Name="order"/>
        > > <UseUniqueKey Name="PrimaryKey"/>
        > > <UseForeignKey Name="FK_ORDER"/>
        > > </RelatedClass>
        > > </ClassMap>
        > > </Maps>
        > > </XMLToDBMS>
        > >
        > > I still think this is somehow bound up in the relationship
        between
        > > the tables and the keys used to relate them...
        > >
        > > Again thanks for any help.
        > >
        > >
        > > Scott.
      Your message has been successfully submitted and would be delivered to recipients shortly.