comparison src/c/urweb.c @ 1941:9f3597979e98

Tweaking handling of database transactions
author Adam Chlipala <adam@chlipala.net>
date Wed, 25 Dec 2013 13:11:43 -0500
parents c52365a4ce41
children a671e5258a2c
comparison
equal deleted inserted replaced
1940:1484ba362062 1941:9f3597979e98
3223 3223
3224 for (i = ctx->used_transactionals-1; i >= 0; --i) 3224 for (i = ctx->used_transactionals-1; i >= 0; --i)
3225 if (ctx->transactionals[i].free) 3225 if (ctx->transactionals[i].free)
3226 ctx->transactionals[i].free(ctx->transactionals[i].data, will_retry); 3226 ctx->transactionals[i].free(ctx->transactionals[i].data, will_retry);
3227 3227
3228 return (ctx->app && ctx->transaction_started) ? ctx->app->db_rollback(ctx) : 0; 3228 if (ctx->app && ctx->transaction_started) {
3229 ctx->transaction_started = 0;
3230 return ctx->app->db_rollback(ctx);
3231 } else
3232 return 0;
3229 } 3233 }
3230 3234
3231 static const char begin_xhtml[] = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">"; 3235 static const char begin_xhtml[] = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">";
3232 3236
3233 extern int uw_hash_blocksize; 3237 extern int uw_hash_blocksize;
3459 failure_kind fk = UNLIMITED_RETRY; 3463 failure_kind fk = UNLIMITED_RETRY;
3460 if (prev) 3464 if (prev)
3461 prev->next = next; 3465 prev->next = next;
3462 else 3466 else
3463 clients_used = next; 3467 clients_used = next;
3464 uw_reset(ctx);
3465 while (fk == UNLIMITED_RETRY) { 3468 while (fk == UNLIMITED_RETRY) {
3469 uw_reset(ctx);
3466 fk = uw_expunge(ctx, c->id, c->data); 3470 fk = uw_expunge(ctx, c->id, c->data);
3467 if (fk == UNLIMITED_RETRY) 3471 if (fk == UNLIMITED_RETRY)
3468 printf("Unlimited retry during expunge: %s\n", uw_error_message(ctx)); 3472 printf("Unlimited retry during expunge: %s\n", uw_error_message(ctx));
3469 } 3473 }
3470 if (fk == SUCCESS) 3474 if (fk == SUCCESS)