Mercurial > urweb
comparison src/postgres.sml @ 1938:d02c1a0d8082
Proper handling of serialization failures during SQL COMMIT
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Mon, 23 Dec 2013 15:59:17 +0000 |
parents | 6745eafff617 |
children | 0992323fa264 |
comparison
equal
deleted
inserted
replaced
1937:94f9570671f0 | 1938:d02c1a0d8082 |
---|---|
436 newline, | 436 newline, |
437 string "if (res == NULL) return 1;", | 437 string "if (res == NULL) return 1;", |
438 newline, | 438 newline, |
439 newline, | 439 newline, |
440 string "if (PQresultStatus(res) != PGRES_COMMAND_OK) {", | 440 string "if (PQresultStatus(res) != PGRES_COMMAND_OK) {", |
441 box [string "PQclear(res);", | 441 box [string "if (!strcmp(PQresultErrorField(res, PG_DIAG_SQLSTATE), \"40001\")) {", |
442 box [newline, | |
443 string "PQclear(res);", | |
444 newline, | |
445 string "return -1;", | |
446 newline], | |
447 string "}", | |
448 newline, | |
449 string "if (!strcmp(PQresultErrorField(res, PG_DIAG_SQLSTATE), \"40P01\")) {", | |
450 box [newline, | |
451 string "PQclear(res);", | |
452 newline, | |
453 string "return -1;", | |
454 newline], | |
455 string "}", | |
456 newline, | |
457 string "PQclear(res);", | |
442 newline, | 458 newline, |
443 string "return 1;", | 459 string "return 1;", |
444 newline], | 460 newline], |
445 string "}", | 461 string "}", |
446 newline, | 462 newline, |