diff src/c/urweb.c @ 885:e6070333d8a8

demo/sql works with SQLite
author Adam Chlipala <adamc@hcoop.net>
date Fri, 17 Jul 2009 16:29:36 -0400
parents b2a175a0f2ef
children 8e540df3294d
line wrap: on
line diff
--- a/src/c/urweb.c	Fri Jul 17 14:04:05 2009 -0400
+++ b/src/c/urweb.c	Fri Jul 17 16:29:36 2009 -0400
@@ -1990,12 +1990,18 @@
 
     switch (c) {
     case '\'':
-      strcpy(s2, "\\'");
+      if (uw_Estrings)
+        strcpy(s2, "\\'");
+      else
+        strcpy(s2, "''");
       s2 += 2;
       break;
     case '\\':
-      strcpy(s2, "\\\\");
-      s2 += 2;
+      if (uw_Estrings) {
+        strcpy(s2, "\\\\");
+        s2 += 2;
+      } else
+        *s2++ = '\\';
       break;
     default:
       if (isprint(c))
@@ -2033,12 +2039,18 @@
 
     switch (c) {
     case '\'':
-      strcpy(s2, "\\'");
+      if (uw_Estrings)
+        strcpy(s2, "\\'");
+      else
+        strcpy(s2, "''");
       s2 += 2;
       break;
     case '\\':
-      strcpy(s2, "\\\\\\\\");
-      s2 += 4;
+      if (uw_Estrings) {
+        strcpy(s2, "\\\\\\\\");
+        s2 += 4;
+      } else
+        *s2++ = '\\';
       break;
     default:
       if (isprint(c))
@@ -2549,10 +2561,16 @@
 
 int uw_rollback(uw_context ctx) {
   size_t i;
+  cleanup *cl;
 
   if (ctx->client)
     release_client(ctx->client);
 
+  for (cl = ctx->cleanup; cl < ctx->cleanup_front; ++cl)
+    cl->func(cl->arg);
+
+  ctx->cleanup_front = ctx->cleanup;
+
   for (i = 0; i < ctx->used_transactionals; ++i)
     if (ctx->transactionals[i].rollback != NULL)
       ctx->transactionals[i].rollback(ctx->transactionals[i].data);