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

663Re: [xml-dbms] UPDATE & DELETE

Expand Messages
  • Ronald Bourret
    Feb 12, 2001
      Robin Fried wrote:
      > Concerning deletion in violoation of referential integrity, why wouldn't you
      > just roll back the operation and throw a XML-DBMS_INTEGRITYVIOLATION
      > exception?

      This is what will happen if the user tries to delete something and that
      deletion violates referential integrity. (The actual error will come
      from the database as a SQLException.)

      What I was referring to was how DBMSDelete needs to function internally
      to avoid accidentally violating referential integrity. For example,
      consider the sales example. Suppose I want to delete a sales order and
      pass the Sales table and sales order number 123 to DBMSDelete.

      The internal Map objects that drive DBMSDelete show a hierarchy of
      tables in the database from which rows are to be deleted:

      | \
      Lines Customers

      If DBMSDelete just starts at the top of this hierarchy and starts
      deleting rows, it will run into referential integrity problems. For
      example, if it tries to delete a row from Sales before deleting any rows
      in Lines, the database will return a referential integrity error since
      the rows in Lines will still have foreign keys pointing to the deleted
      row. The solution then is for DBMSDelete to delete the rows in Lines

      (Note that DBMSDelete could simply use cascading deletes to solve this
      problem. However, these are not supported by all databases, so instead
      it should work around the problem as stated in my previous email.)

      Ronald Bourret
      Programming, Writing, and Training
      XML, Databases, and Schemas
    • Show all 11 messages in this topic