User Tools

Site Tools


pracro:database

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
pracro:database [2010/06/03 16:33] devapracro:database [2010/06/07 11:17] (current) deva
Line 8: Line 8:
 The first SQL command issued is BEGIN; The first SQL command issued is BEGIN;
 If a 'commit' is received by the pracro server, it is translated into a COMMIT; on the SQL connection and the command string is cleared. If a 'commit' is received by the pracro server, it is translated into a COMMIT; on the SQL connection and the command string is cleared.
-If the clienbt disconnects without any actions, an ROLLBACK; is sent to the SQL server.+If the client disconnects without any actions, an ROLLBACK; is sent to the SQL server.
 On reconnect to the session, the entire command string is replayed as it is, and the session is ready to continue where it left off. On reconnect to the session, the entire command string is replayed as it is, and the session is ready to continue where it left off.
-On the pracro 'discard' command, a ROLLBACK; is sent to the SQL server, and the command string is cleared.+On the Pracro 'discard' command, a ROLLBACK; is sent to the SQL server, and the command string is cleared.
  
-====Sequence numbers==== +=====Journal uptodateness check===== 
-All sequence numbers must be obtained from seperate SQL conenctionthat is not affected by the SQL transactionsIt is vital that these numbers are not reused in later sessions+  * Person A is working on patient P. 
-All sequence numbers used in the pracro sessions must therefor be used as stringsdirectly in the syntax strings.+  * Person A commits the macro Mwith data "data from A". 
 +  * Person A 'close no commit'
 +  * Person B starts working on patient P. 
 +  * Person B commits the macro M, with data "data from B". 
 +  * Person B 'close and commit'
 +  * Person A continues work on patient P. 
 +  * Person A sees the resume of M being "data from B"and acknowledges it. 
 +  * Person A 'close and commit' 
 +Person A now **thinks** that the journal contains "data from B"But in fact it contains
 <code> <code>
-global Db1 +data from B 
-getSeq() +data from A
-+
-  Mutex.lock +
-  s = Db1.exec("currval('trseq')"); +
-  Mutex.unlock +
-  return s; +
-+
- +
-do_something +
-+
-   Db2 +
-   Db2.exec("BEGIN"); +
-   Db2.exec("INSERT INTO fields VALUES('foo', 'bar','"+getSeq()+"')"); +
-}+
 </code> </code>
 +This is due to two problems: The field shown on the active session is not nesecarily the one being commit, when the entire session is committed. Second person A cannot see what changes has been made by others.
 +
pracro/database.1275575593.txt.gz · Last modified: 2010/06/03 16:33 by deva