Show More
@@ -26,7 +26,7 b' Whenever an object is fetched from the d' | |||||
26 | (make-instance 'person :name "someseven") |
|
26 | (make-instance 'person :name "someseven") | |
27 | ;=> #<PERSON 54 {10057EB383}> |
|
27 | ;=> #<PERSON 54 {10057EB383}> | |
28 |
|
28 | |||
29 |
(find-dao 'person |
|
29 | (find-dao 'person 'name "someseven") | |
30 | ;=> #<PERSON 54 {10057EB383}> |
|
30 | ;=> #<PERSON 54 {10057EB383}> | |
31 | ``` |
|
31 | ``` | |
32 |
|
32 | |||
@@ -47,7 +47,7 b' Same, but never accesses the database. I' | |||||
47 | The transaction system tries to keep in-image objects and database rows in sync. Ideally they should only be out-of-sync during a transaction. When a transaction is committed all changed objects are synced to the database. When a transaction is rolled back all objects get their pre-transaction slot values back. `make-instance` automatically puts the object in both the database and the cache. You don't have to ever use `mito:save-dao`, `mito:insert-dao`, or `mito:update-dao`. Modifying non-ghost slots outside of a transaction is forbidden. |
|
47 | The transaction system tries to keep in-image objects and database rows in sync. Ideally they should only be out-of-sync during a transaction. When a transaction is committed all changed objects are synced to the database. When a transaction is rolled back all objects get their pre-transaction slot values back. `make-instance` automatically puts the object in both the database and the cache. You don't have to ever use `mito:save-dao`, `mito:insert-dao`, or `mito:update-dao`. Modifying non-ghost slots outside of a transaction is forbidden. | |
48 |
|
48 | |||
49 | ```cl |
|
49 | ```cl | |
50 |
(let (( |
|
50 | (let ((person (make-person))) | |
51 | (with-transaction () |
|
51 | (with-transaction () | |
52 | (incf (age person)) |
|
52 | (incf (age person)) | |
53 | (if (check-something person) |
|
53 | (if (check-something person) | |
@@ -56,7 +56,7 b' The transaction system tries to keep in-' | |||||
56 | (setf (name person) "foo")) ; ERROR |
|
56 | (setf (name person) "foo")) ; ERROR | |
57 | ``` |
|
57 | ``` | |
58 |
|
58 | |||
59 |
Transactions are also |
|
59 | Transactions are also committed on normal exit and rolled back on non-local exit. | |
60 |
|
60 | |||
61 | ##### WITH-TRANSACTION () &BODY *BODY* |
|
61 | ##### WITH-TRANSACTION () &BODY *BODY* | |
62 |
|
62 | |||
@@ -64,7 +64,7 b' Runs the body inside a transaction. Nest' | |||||
64 |
|
64 | |||
65 | ##### COMMIT and ROLLBACK |
|
65 | ##### COMMIT and ROLLBACK | |
66 |
|
66 | |||
67 | Functions to commit or rollback a transaction. Defined locally inside `with-transaction` body. |
|
67 | Functions to commit or rollback a transaction. Defined locally inside `with-transaction` body. Either call terminates the transaction without evaluating its remainder. | |
68 |
|
68 | |||
69 | ## License |
|
69 | ## License | |
70 |
|
70 |
General Comments 0
You need to be logged in to leave comments.
Login now