Mercurial > urweb
comparison src/postgres.sml @ 1936:6745eafff617
Start SQL transactions as read-only when possible, based on conservative program analysis
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 12 Dec 2013 17:42:48 -0500 |
parents | 2f33d9a51765 |
children | d02c1a0d8082 |
comparison
equal
deleted
inserted
replaced
1935:fda9d5af69e7 | 1936:6745eafff617 |
---|---|
400 newline, | 400 newline, |
401 string "}", | 401 string "}", |
402 newline, | 402 newline, |
403 newline, | 403 newline, |
404 | 404 |
405 string "static int uw_db_begin(uw_context ctx) {", | 405 string "static int uw_db_begin(uw_context ctx, int could_write) {", |
406 newline, | 406 newline, |
407 string "PGconn *conn = uw_get_db(ctx);", | 407 string "PGconn *conn = uw_get_db(ctx);", |
408 newline, | 408 newline, |
409 string "PGresult *res = PQexec(conn, \"BEGIN ISOLATION LEVEL SERIALIZABLE\");", | 409 string "PGresult *res = PQexec(conn, could_write ? \"BEGIN ISOLATION LEVEL SERIALIZABLE\" : \"BEGIN ISOLATION LEVEL SERIALIZABLE, READ ONLY\");", |
410 newline, | 410 newline, |
411 newline, | 411 newline, |
412 string "if (res == NULL) return 1;", | 412 string "if (res == NULL) return 1;", |
413 newline, | 413 newline, |
414 newline, | 414 newline, |