|
|
@ -2904,32 +2904,30 @@ bool sharesummaries_to_markersummaries(PGconn *conn, WORKMARKERS *workmarkers, |
|
|
|
ss_item = ss_prev; |
|
|
|
ss_item = ss_prev; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (old_sharesummary_store->count == 0) |
|
|
|
if (conn == NULL) { |
|
|
|
reason = "no sharesummaries"; |
|
|
|
conn = dbconnect(); |
|
|
|
else { |
|
|
|
conned = true; |
|
|
|
if (conn == NULL) { |
|
|
|
} |
|
|
|
conn = dbconnect(); |
|
|
|
|
|
|
|
conned = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
res = PQexec(conn, "Begin", CKPQ_WRITE); |
|
|
|
res = PQexec(conn, "Begin", CKPQ_WRITE); |
|
|
|
rescode = PQresultStatus(res); |
|
|
|
rescode = PQresultStatus(res); |
|
|
|
PQclear(res); |
|
|
|
PQclear(res); |
|
|
|
if (!PGOK(rescode)) { |
|
|
|
if (!PGOK(rescode)) { |
|
|
|
PGLOGERR("Begin", rescode, conn); |
|
|
|
PGLOGERR("Begin", rescode, conn); |
|
|
|
goto flail; |
|
|
|
goto flail; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ms_item = new_markersummary_store->head; |
|
|
|
ms_item = new_markersummary_store->head; |
|
|
|
while (ms_item) { |
|
|
|
while (ms_item) { |
|
|
|
if (!(markersummary_add(conn, ms_item, by, code, inet, |
|
|
|
if (!(markersummary_add(conn, ms_item, by, code, inet, |
|
|
|
cd, trf_root))) { |
|
|
|
cd, trf_root))) { |
|
|
|
reason = "db error"; |
|
|
|
reason = "db error"; |
|
|
|
goto rollback; |
|
|
|
goto rollback; |
|
|
|
} |
|
|
|
|
|
|
|
ms_item = ms_item->next; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ms_item = ms_item->next; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (old_sharesummary_store->count > 0) { |
|
|
|
par = 0; |
|
|
|
par = 0; |
|
|
|
params[par++] = bigint_to_buf(workmarkers->workinfoidstart, NULL, 0); |
|
|
|
params[par++] = bigint_to_buf(workmarkers->workinfoidstart, NULL, 0); |
|
|
|
params[par++] = bigint_to_buf(workmarkers->workinfoidend, NULL, 0); |
|
|
|
params[par++] = bigint_to_buf(workmarkers->workinfoidend, NULL, 0); |
|
|
@ -2958,23 +2956,23 @@ bool sharesummaries_to_markersummaries(PGconn *conn, WORKMARKERS *workmarkers, |
|
|
|
reason = "delete mismatch"; |
|
|
|
reason = "delete mismatch"; |
|
|
|
goto rollback; |
|
|
|
goto rollback; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ok = workmarkers_process(conn, true, true, |
|
|
|
ok = workmarkers_process(conn, true, true, |
|
|
|
workmarkers->markerid, |
|
|
|
workmarkers->markerid, |
|
|
|
workmarkers->poolinstance, |
|
|
|
workmarkers->poolinstance, |
|
|
|
workmarkers->workinfoidend, |
|
|
|
workmarkers->workinfoidend, |
|
|
|
workmarkers->workinfoidstart, |
|
|
|
workmarkers->workinfoidstart, |
|
|
|
workmarkers->description, |
|
|
|
workmarkers->description, |
|
|
|
MARKER_PROCESSED_STR, |
|
|
|
MARKER_PROCESSED_STR, |
|
|
|
by, code, inet, cd, trf_root); |
|
|
|
by, code, inet, cd, trf_root); |
|
|
|
rollback: |
|
|
|
rollback: |
|
|
|
if (ok) |
|
|
|
if (ok) |
|
|
|
res = PQexec(conn, "Commit", CKPQ_WRITE); |
|
|
|
res = PQexec(conn, "Commit", CKPQ_WRITE); |
|
|
|
else |
|
|
|
else |
|
|
|
res = PQexec(conn, "Rollback", CKPQ_WRITE); |
|
|
|
res = PQexec(conn, "Rollback", CKPQ_WRITE); |
|
|
|
|
|
|
|
|
|
|
|
PQclear(res); |
|
|
|
PQclear(res); |
|
|
|
} |
|
|
|
|
|
|
|
flail: |
|
|
|
flail: |
|
|
|
for (n = 0; n < par; n++) |
|
|
|
for (n = 0; n < par; n++) |
|
|
|
free(params[n]); |
|
|
|
free(params[n]); |
|
|
|