Hello,
I was wondering if I could ask another question.
Suppose I have a database with several clients accessing (reading and
writing) a document (called "doc" for example) with a bunch of elements
like:
<ROOT>
<ELEMENT1 id="1">
<ELEMENT2 id="2"/>
<ELEMENT3 id="3"/>
</ELEMENT1>
<ELEMENT4 id="4"/>
...
...
...
</ROOT>
and I want to make sure each element has a unique id. My thought is to use
another document (called the "COUNTER" document) having:
<COUNTER>
<COUNT>10</COUNT>
<COUNTER>
whenever a client adds elements to the first document, the application would
read the COUNT value, then add to that value however many new elements are
to be added
to the "doc" document. Then it could insert the new elements starting at
the origional COUNT value + 1 to the new COUNT value.
So if a client was to add 5 new elements, the following would happen:
The count would be determined by executing the following query (would return
10 in the above example):
data(doc("COUNTER")/COUNTER)
The count would be incrementd by 5 with the following query:
UPDATE REPLACE $x in doc("COUNTER")/COUNTER/COUNT with <COUNT>{$x+5}</COUNT>
Then starting at 11 till 15, Elements would be added in with the following
query (with x replaced by number)
UPDATE insert(<ELENMENTx id='x'></ELEMENTx>) into doc("doc")//
Is there a way to ensure that between the read of the COUNT value, and the
UPDATE of the COUNT value, that no other client reads or writes to the COUNT
value?
Thanks in advance for any help,
Garrett.
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion