diff --git a/src/ckdb.h b/src/ckdb.h index 05a77bca..9c414fca 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -58,7 +58,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.7" -#define CKDB_VERSION DB_VERSION"-2.600" +#define CKDB_VERSION DB_VERSION"-2.601" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_dbio.c b/src/ckdb_dbio.c index d23ed730..de1d9996 100644 --- a/src/ckdb_dbio.c +++ b/src/ckdb_dbio.c @@ -615,14 +615,8 @@ bool users_update(PGconn *conn, K_ITEM *u_item, char *oldhash, PARCHKVAL(par, 3, params); conned = CKPQConn(&conn); - // Beginning of a write txn - res = CKPQExec(conn, "Begin", CKPQ_WRITE); - rescode = CKPQResultStatus(res); - CKPQClear(res); - if (!PGOK(rescode)) { - PGLOGERR("Begin", rescode, conn); + if (!CKPQBegin(conn)) goto unparam; - } res = CKPQExecParams(conn, upd, par, NULL, (const char **)params, NULL, NULL, 0, CKPQ_WRITE); rescode = CKPQResultStatus(res); @@ -873,14 +867,8 @@ bool users_replace(PGconn *conn, K_ITEM *u_item, K_ITEM *old_u_item, char *by, PARCHKVAL(par, 3, params); conned = CKPQConn(&conn); - // Beginning of a write txn - res = CKPQExec(conn, "Begin", CKPQ_WRITE); - rescode = CKPQResultStatus(res); - CKPQClear(res); - if (!PGOK(rescode)) { - PGLOGERR("Begin", rescode, conn); + if (!CKPQBegin(conn)) goto unparam; - } res = CKPQExecParams(conn, upd, par, NULL, (const char **)params, NULL, NULL, 0, CKPQ_WRITE); rescode = CKPQResultStatus(res); @@ -1687,13 +1675,8 @@ bool workers_update(PGconn *conn, K_ITEM *item, char *difficultydefault, PARCHKVAL(par, 3, params); conned = CKPQConn(&conn); - res = CKPQExec(conn, "Begin", CKPQ_WRITE); - rescode = CKPQResultStatus(res); - CKPQClear(res); - if (!PGOK(rescode)) { - PGLOGERR("Begin", rescode, conn); + if (!CKPQBegin(conn)) goto unparam; - } res = CKPQExecParams(conn, upd, par, NULL, (const char **)params, NULL, NULL, 0, CKPQ_WRITE); rescode = CKPQResultStatus(res);