diff src/c/urweb.c @ 2056:a9159911c3ba

New phase: Dbmodecheck
author Adam Chlipala <adam@chlipala.net>
date Sun, 17 Aug 2014 13:07:56 -0400
parents 4ad46302f659
children d77b0665ba7c ef766ef6e242
line wrap: on
line diff
--- a/src/c/urweb.c	Sun Aug 10 13:40:53 2014 -0400
+++ b/src/c/urweb.c	Sun Aug 17 13:07:56 2014 -0400
@@ -441,7 +441,7 @@
 
   const char *script_header;
 
-  int needs_push, needs_sig, could_write_db;
+  int needs_push, needs_sig, could_write_db, at_most_one_query;
 
   size_t n_deltas, used_deltas;
   delta *deltas;
@@ -520,6 +520,7 @@
   ctx->needs_push = 0;
   ctx->needs_sig = 0;
   ctx->could_write_db = 1;
+  ctx->at_most_one_query = 0;
 
   ctx->source_count = 0;
 
@@ -786,7 +787,7 @@
 }
 
 void uw_ensure_transaction(uw_context ctx) {
-  if (!ctx->transaction_started) {
+  if (!ctx->transaction_started && !ctx->at_most_one_query) {
     if (ctx->app->db_begin(ctx, ctx->could_write_db))
       uw_error(ctx, BOUNDED_RETRY, "Error running SQL BEGIN");
     ctx->transaction_started = 1;
@@ -1205,6 +1206,10 @@
   ctx->could_write_db = n;
 }
 
+void uw_set_at_most_one_query(uw_context ctx, int n) {
+  ctx->at_most_one_query = n;
+}
+
 
 static void uw_buffer_check_ctx(uw_context ctx, const char *kind, uw_buffer *b, size_t extra, const char *desc) {
   if (b->back - b->front < extra) {