diff src/cjr_print.sml @ 1931:1a04b1edded2

Fix regression in http.c for long-polling connections; add lazy initialization of database connections, to avoid the overhead in handlers that don't use SQL
author Adam Chlipala <adam@chlipala.net>
date Wed, 11 Dec 2013 14:57:54 -0500
parents 0354df1b6849
children 98895243b5b6
line wrap: on
line diff
--- a/src/cjr_print.sml	Wed Dec 11 11:06:08 2013 -0500
+++ b/src/cjr_print.sml	Wed Dec 11 14:57:54 2013 -0500
@@ -2079,6 +2079,8 @@
                  newline,
                  string "int dummy = (uw_begin_region(ctx), 0);",
                  newline,
+                 string "uw_ensure_transaction(ctx);",
+                 newline,
                  
                  case prepared of
                      NONE =>
@@ -2140,6 +2142,8 @@
                               p_exp' false false env dml,
                               string ";",
                               newline,
+                              string "uw_ensure_transaction(ctx);",
+                              newline,
                               newline,
                               #dml (Settings.currentDbms ()) (loc, mode)]
                | SOME {id, dml = dml'} =>
@@ -2159,8 +2163,10 @@
                                                        string ";"])
                                       inputs,
                           newline,
+                          string "uw_ensure_transaction(ctx);",
                           newline,
-
+                          newline,
+                          
                           #dmlPrepared (Settings.currentDbms ()) {loc = loc,
                                                                   id = id,
                                                                   dml = dml',
@@ -2184,6 +2190,8 @@
              newline,
              string "uw_Basis_int n;",
              newline,
+             string "uw_ensure_transaction(ctx);",
+             newline,
 
              case prepared of
                  NONE => #nextval (Settings.currentDbms ()) {loc = loc,
@@ -2204,6 +2212,8 @@
       | ESetval {seq, count} =>
         box [string "({",
              newline,
+             string "uw_ensure_transaction(ctx);",
+             newline,
 
              #setval (Settings.currentDbms ()) {loc = loc,
                                                 seqE = p_exp' false false env seq,