pracro:database
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Last revisionBoth sides next revision | ||
pracro:database [2008/11/25 09:00] – deva | pracro:database [2010/06/03 16:33] – 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 ' | ||
+ | If the clienbt 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 ' | ||
+ | |||
+ | ====Sequence numbers==== | ||
+ | All sequence numbers must be obtained from a seperate SQL conenction, that is not affected by the SQL transactions. It is vital that these numbers are not reused in later sessions. | ||
+ | All sequence numbers used in the pracro sessions must therefor be used as strings, directly in the syntax strings. | ||
+ | < | ||
+ | global Db1 | ||
+ | getSeq() | ||
+ | { | ||
+ | Mutex.lock | ||
+ | s = Db1.exec(" | ||
+ | Mutex.unlock | ||
+ | return s; | ||
+ | } | ||
+ | |||
+ | do_something | ||
+ | { | ||
+ | Db2 | ||
+ | | ||
+ | | ||
+ | } | ||
+ | </ |
pracro/database.txt · Last modified: 2010/06/07 11:17 by deva