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

3863UpdateOrInsert action...

Expand Messages
  • jazzgeir
    Sep 7, 2009
    • 0 Attachment
      I'm using xml-dbms in a project where I want researchers to be able to update and insert data in the database by way of XML-DBMS, preferrably both updating and inserting using the same mapping file.

      Typical process: Export a material to xml, edit xml with xml editor, upload to DB.

      Another typical process: Start writing a new XML file and upload to DB.

      It is very convenient to use the very same mapping file to make sure there is a well-defined XML structure

      I've been experimenting a bit with the different actions, and found out, eventually that UpdateOrInsert is quite flexible, but there are a couple of things that look strange to me.

      First of all, when updating, if you leave out properties or attributes from the XML, these are set to "NULL" in DB when importing back. I find this unnatural, wouldn't it be better to update just the fields given in XML instead of setting the non-existing columns = NULL? Or will I have to make a separate mapping file for entering new data opposed to editing data? Editing data always include entering new data anyway, so it is not feasable to separate the two...

      Next, if you're using an auto incremented primary key, and leave out the primary key from the XML data, and import again, the record is still updated if all the columns are equal to the referred row, like I said even if the key is not given in XML. And I get errors like "data changed"... It would be nice to get an explanation of when records are updated, and when they are inserted when using the UpdateOrInsert action for a given table...

      As soon as I start importing newly entered new records (i.e. records not present in DB) in XML, I get the error "Couldn't retrieve inserted row due to changed values.". I can't specify the primary key, since this is generated by the DB, and the user would not have any idea of what to enter there anyway...

      I will not post map, action and xml files here since they tend to get longish. I can post fragments if neede, but I thought I'd start with asking a more general question first...

      ---Asgeir---
    • Show all 2 messages in this topic