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
Next revision
Previous revision
pracro:database [2008/11/25 09:00] devapracro:database [2010/06/07 11:17] (current) deva
Line 1: Line 1:
 ======Pracro Database design====== ======Pracro Database design======
 Nothing to see here, move along... Nothing to see here, move along...
 +
 +=====Persistent transactions=====
 +When a new Pracro session is initiated, a connection to PostgreSQL is made.
 +All commands (strings) issued to this connection, will be appended to a string contained in the session class.
 +This string will be serialised with the rest of the session data upon pracrod shutdown and re-read on startup.
 +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 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 the Pracro 'discard' command, a ROLLBACK; is sent to the SQL server, and the command string is cleared.
 +
 +=====Journal uptodateness check=====
 +  * Person A is working on a patient P.
 +  * Person A commits the macro M, with 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>
 +data from B
 +data from A
 +</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.1227600031.txt.gz · Last modified: 2008/11/25 09:00 by deva