summaryrefslogtreecommitdiff
path: root/src/cjr_print.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2013-12-12 17:42:48 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2013-12-12 17:42:48 -0500
commita24c2bdaf85c3d4eef19783e95b11d1cf15add09 (patch)
treed3c882ae31c045044de6538db6dc9e13cf347f66 /src/cjr_print.sml
parent106d1b7275e44cf419665e92b2682e009b51f095 (diff)
Start SQL transactions as read-only when possible, based on conservative program analysis
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r--src/cjr_print.sml13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index 798492d6..5d697eac 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -3001,11 +3001,18 @@ fun p_file env (ds, ps) =
fun couldWrite ek =
case ek of
- Link => false
+ Link _ => false
| Action ef => ef = ReadCookieWrite
| Rpc ef => ef = ReadCookieWrite
| Extern _ => false
+ fun couldWriteDb ek =
+ case ek of
+ Link ef => ef <> ReadOnly
+ | Action ef => ef <> ReadOnly
+ | Rpc ef => ef <> ReadOnly
+ | Extern ef => ef <> ReadOnly
+
val s =
case Settings.getUrlPrefix () of
"" => s
@@ -3091,6 +3098,10 @@ fun p_file env (ds, ps) =
end,
string "\");",
newline]),
+ string "uw_set_could_write_db(ctx, ",
+ string (if couldWriteDb ek then "1" else "0"),
+ string ");",
+ newline,
string "uw_set_needs_push(ctx, ",
string (case side of
ServerAndPullAndPush => "1"