summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mysql.sml19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/mysql.sml b/src/mysql.sml
index a119321c..3b59d1c1 100644
--- a/src/mysql.sml
+++ b/src/mysql.sml
@@ -854,11 +854,20 @@ fun queryCommon {loc, query, cols, doCols} =
newline,
newline,
- string "if (mysql_stmt_execute(stmt)) uw_error(ctx, FATAL, \"",
- string (ErrorMsg.spanToString loc),
- string ": Error executing query: %s\\n%s\", ",
- query,
- string ", mysql_error(conn->conn));",
+ string "if (mysql_stmt_execute(stmt)) {",
+ newline,
+ box [string "if (mysql_errno(conn->conn) == 1213)",
+ newline,
+ box [string "uw_error(ctx, UNLIMITED_RETRY, \"Deadlock detected\");",
+ newline],
+ newline,
+ string "uw_error(ctx, FATAL, \"",
+ string (ErrorMsg.spanToString loc),
+ string ": Error executing query: %s\\n%s\", ",
+ query,
+ string ", mysql_error(conn->conn));",
+ newline],
+ string "}",
newline,
newline,