summaryrefslogtreecommitdiff
path: root/src/c
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-07-17 16:29:36 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-07-17 16:29:36 -0400
commit0c42fe7e8be44f7314e53259c33f6e45fe3078d9 (patch)
treedfa6ca9540f8f3d2015929a33a2971529c7b887f /src/c
parent92e6bcf287f4a6984599d1599f7437293be72ba1 (diff)
demo/sql works with SQLite
Diffstat (limited to 'src/c')
-rw-r--r--src/c/urweb.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index cf44686a..572d1658 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -1990,12 +1990,18 @@ uw_Basis_string uw_Basis_sqlifyString(uw_context ctx, uw_Basis_string s) {
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 @@ uw_Basis_string uw_Basis_sqlifyBlob(uw_context ctx, uw_Basis_blob b) {
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 @@ void uw_commit(uw_context ctx) {
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);