Skip to content

my_myql: Handle deadlocks in mysql_stmt_execute #162

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions mx_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,13 @@ static int mx__mysql_stmt_bind_result(struct mx_mysql_stmt *stmt)

static int mx__mysql_stmt_execute(struct mx_mysql_stmt *stmt)
{
int res;

assert(stmt);
assert(stmt->stmt);

res = mysql_stmt_execute(stmt->stmt);
if (res == 0)
return 0;
do {
if (mysql_stmt_execute(stmt->stmt) == 0)
return 0;
} while (mysql_stmt_errno(stmt->stmt) == ER_LOCK_DEADLOCK);

mx_mysql_save_error(mysql_stmt_error(stmt->stmt));

Expand Down