diff --git a/src/ckdb.h b/src/ckdb.h index 419dc45c..827b99ea 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -51,7 +51,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.4" -#define CKDB_VERSION DB_VERSION"-1.930" +#define CKDB_VERSION DB_VERSION"-1.940" #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 eed647f2..9c827785 100644 --- a/src/ckdb_dbio.c +++ b/src/ckdb_dbio.c @@ -2943,6 +2943,14 @@ bool workinfo_fill(PGconn *conn) return false; } + res = PQexec(conn, "Lock table workinfo in access exclusive mode", CKPQ_READ); + rescode = PQresultStatus(res); + PQclear(res); + if (!PGOK(rescode)) { + PGLOGERR("Lock", rescode, conn); + goto flail; + } + res = PQexecParams(conn, sel, par, NULL, (const char **)params, NULL, NULL, 0, CKPQ_READ); rescode = PQresultStatus(res); PQclear(res); @@ -5468,6 +5476,14 @@ bool miningpayouts_fill(PGconn *conn) return false; } + res = PQexec(conn, "Lock table miningpayouts in access exclusive mode", CKPQ_READ); + rescode = PQresultStatus(res); + PQclear(res); + if (!PGOK(rescode)) { + PGLOGERR("Lock", rescode, conn); + goto flail; + } + res = PQexec(conn, sel, CKPQ_READ); rescode = PQresultStatus(res); PQclear(res); @@ -6967,9 +6983,6 @@ bool markersummary_fill(PGconn *conn) LOGDEBUG("%s(): select", __func__); - printf(TICK_PREFIX"ms 0\r"); - fflush(stdout); - // TODO: limit how far back sel = "declare ws cursor for select " "markerid,userid,workername,diffacc,diffsta,diffdup,diffhi," @@ -6987,6 +7000,9 @@ bool markersummary_fill(PGconn *conn) LOGWARNING("%s(): loading from markerid>=%s", __func__, params[0]); + printf(TICK_PREFIX"ms 0\r"); + fflush(stdout); + res = PQexec(conn, "Begin", CKPQ_READ); rescode = PQresultStatus(res); PQclear(res); @@ -6995,6 +7011,14 @@ bool markersummary_fill(PGconn *conn) return false; } + res = PQexec(conn, "Lock table markersummary in access exclusive mode", CKPQ_READ); + rescode = PQresultStatus(res); + PQclear(res); + if (!PGOK(rescode)) { + PGLOGERR("Lock", rescode, conn); + goto flail; + } + res = PQexecParams(conn, sel, par, NULL, (const char **)params, NULL, NULL, 0, CKPQ_READ); rescode = PQresultStatus(res); PQclear(res);