|
|
@ -9,17 +9,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include "ckdb.h" |
|
|
|
#include "ckdb.h" |
|
|
|
|
|
|
|
|
|
|
|
// Doesn't work with negative numbers ...
|
|
|
|
|
|
|
|
void pcom(int n) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (n < 1000) |
|
|
|
|
|
|
|
printf("%d", n); |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
pcom(n/1000); |
|
|
|
|
|
|
|
printf(",%03d", n % 1000); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *pqerrmsg(PGconn *conn) |
|
|
|
char *pqerrmsg(PGconn *conn) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char *ptr, *buf = strdup(PQerrorMessage(conn)); |
|
|
|
char *ptr, *buf = strdup(PQerrorMessage(conn)); |
|
|
@ -3275,6 +3264,7 @@ unparam: |
|
|
|
|
|
|
|
|
|
|
|
bool workinfo_fill(PGconn *conn) |
|
|
|
bool workinfo_fill(PGconn *conn) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
char tickbuf[256], pcombuf[64]; |
|
|
|
char ndiffbin[TXT_SML+1]; |
|
|
|
char ndiffbin[TXT_SML+1]; |
|
|
|
ExecStatusType rescode; |
|
|
|
ExecStatusType rescode; |
|
|
|
PGresult *res; |
|
|
|
PGresult *res; |
|
|
@ -3290,8 +3280,8 @@ bool workinfo_fill(PGconn *conn) |
|
|
|
|
|
|
|
|
|
|
|
LOGDEBUG("%s(): select", __func__); |
|
|
|
LOGDEBUG("%s(): select", __func__); |
|
|
|
|
|
|
|
|
|
|
|
printf(TICK_PREFIX"wi 0\r"); |
|
|
|
STRNCPY(tickbuf, TICK_PREFIX"wi 0"); |
|
|
|
fflush(stdout); |
|
|
|
cr_msg(false, tickbuf); |
|
|
|
|
|
|
|
|
|
|
|
APPEND_REALLOC_INIT(sel, off, len); |
|
|
|
APPEND_REALLOC_INIT(sel, off, len); |
|
|
|
APPEND_REALLOC(sel, off, len, |
|
|
|
APPEND_REALLOC(sel, off, len, |
|
|
@ -3459,10 +3449,10 @@ bool workinfo_fill(PGconn *conn) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (n == 0 || ((n+1) % 100000) == 0) { |
|
|
|
if (n == 0 || ((n+1) % 100000) == 0) { |
|
|
|
printf(TICK_PREFIX"wi "); |
|
|
|
pcom(n+1, pcombuf, sizeof(pcombuf)); |
|
|
|
pcom(n+1); |
|
|
|
snprintf(tickbuf, sizeof(tickbuf), |
|
|
|
putchar('\r'); |
|
|
|
TICK_PREFIX"wi %s", pcombuf); |
|
|
|
fflush(stdout); |
|
|
|
cr_msg(false, tickbuf); |
|
|
|
} |
|
|
|
} |
|
|
|
tick(); |
|
|
|
tick(); |
|
|
|
n++; |
|
|
|
n++; |
|
|
@ -4007,6 +3997,7 @@ unparam: |
|
|
|
|
|
|
|
|
|
|
|
bool shares_fill(PGconn *conn) |
|
|
|
bool shares_fill(PGconn *conn) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
char tickbuf[256], pcombuf[64]; |
|
|
|
ExecStatusType rescode; |
|
|
|
ExecStatusType rescode; |
|
|
|
PGresult *res; |
|
|
|
PGresult *res; |
|
|
|
K_TREE_CTX ctx[1]; |
|
|
|
K_TREE_CTX ctx[1]; |
|
|
@ -4055,8 +4046,8 @@ bool shares_fill(PGconn *conn) |
|
|
|
|
|
|
|
|
|
|
|
LOGWARNING("%s(): loading from workinfoid>=%"PRId64, __func__, workinfoid); |
|
|
|
LOGWARNING("%s(): loading from workinfoid>=%"PRId64, __func__, workinfoid); |
|
|
|
|
|
|
|
|
|
|
|
printf(TICK_PREFIX"sh 0\r"); |
|
|
|
STRNCPY(tickbuf, TICK_PREFIX"sh 0"); |
|
|
|
fflush(stdout); |
|
|
|
cr_msg(false, tickbuf); |
|
|
|
|
|
|
|
|
|
|
|
sel = "declare sh cursor for select " |
|
|
|
sel = "declare sh cursor for select " |
|
|
|
"workinfoid,userid,workername,clientid,enonce1,nonce2,nonce," |
|
|
|
"workinfoid,userid,workername,clientid,enonce1,nonce2,nonce," |
|
|
@ -4218,10 +4209,10 @@ bool shares_fill(PGconn *conn) |
|
|
|
k_add_head(shares_hi_store, item); |
|
|
|
k_add_head(shares_hi_store, item); |
|
|
|
|
|
|
|
|
|
|
|
if (n == 0 || ((n+1) % 100000) == 0) { |
|
|
|
if (n == 0 || ((n+1) % 100000) == 0) { |
|
|
|
printf(TICK_PREFIX"sh "); |
|
|
|
pcom(n+1, pcombuf, sizeof(pcombuf)); |
|
|
|
pcom(n+1); |
|
|
|
snprintf(tickbuf, sizeof(tickbuf), |
|
|
|
putchar('\r'); |
|
|
|
TICK_PREFIX"sh %s", pcombuf); |
|
|
|
fflush(stdout); |
|
|
|
cr_msg(false, tickbuf); |
|
|
|
} |
|
|
|
} |
|
|
|
tick(); |
|
|
|
tick(); |
|
|
|
n++; |
|
|
|
n++; |
|
|
@ -8333,6 +8324,7 @@ unparam: |
|
|
|
|
|
|
|
|
|
|
|
bool markersummary_fill(PGconn *conn) |
|
|
|
bool markersummary_fill(PGconn *conn) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
char tickbuf[256], pcombuf[64]; |
|
|
|
ExecStatusType rescode; |
|
|
|
ExecStatusType rescode; |
|
|
|
PGresult *res; |
|
|
|
PGresult *res; |
|
|
|
K_ITEM *item = NULL, *p_item, *wm_item = NULL; |
|
|
|
K_ITEM *item = NULL, *p_item, *wm_item = NULL; |
|
|
@ -8434,8 +8426,8 @@ bool markersummary_fill(PGconn *conn) |
|
|
|
params[0], cd, amt, what); |
|
|
|
params[0], cd, amt, what); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
printf(TICK_PREFIX"ms 0\r"); |
|
|
|
STRNCPY(tickbuf, TICK_PREFIX"ms 0"); |
|
|
|
fflush(stdout); |
|
|
|
cr_msg(false, tickbuf); |
|
|
|
|
|
|
|
|
|
|
|
res = PQexec(conn, "Begin", CKPQ_READ); |
|
|
|
res = PQexec(conn, "Begin", CKPQ_READ); |
|
|
|
rescode = PQresultStatus(res); |
|
|
|
rescode = PQresultStatus(res); |
|
|
@ -8637,10 +8629,10 @@ bool markersummary_fill(PGconn *conn) |
|
|
|
userinfo_update(NULL, NULL, row, false); |
|
|
|
userinfo_update(NULL, NULL, row, false); |
|
|
|
|
|
|
|
|
|
|
|
if (n == 0 || ((n+1) % 100000) == 0) { |
|
|
|
if (n == 0 || ((n+1) % 100000) == 0) { |
|
|
|
printf(TICK_PREFIX"ms "); |
|
|
|
pcom(n+1, pcombuf, sizeof(pcombuf)); |
|
|
|
pcom(n+1); |
|
|
|
snprintf(tickbuf, sizeof(tickbuf), |
|
|
|
putchar('\r'); |
|
|
|
TICK_PREFIX"ms %s", pcombuf); |
|
|
|
fflush(stdout); |
|
|
|
cr_msg(false, tickbuf); |
|
|
|
} |
|
|
|
} |
|
|
|
tick(); |
|
|
|
tick(); |
|
|
|
n++; |
|
|
|
n++; |
|
|
|