diff --git a/src/ckdb.h b/src/ckdb.h index a812a33c..a66576e0 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.442" +#define CKDB_VERSION DB_VERSION"-2.443" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c index 48290342..18413aa8 100644 --- a/src/ckdb_cmd.c +++ b/src/ckdb_cmd.c @@ -7612,6 +7612,31 @@ static char *cmd_query(__maybe_unused PGconn *conn, char *cmd, char *id, rows++; } + ok = true; + } else if (strcasecmp(request, "nameram") == 0) { + NAMERAM *nameram = NULL; + K_ITEM *n_item; + + K_RLOCK(nameram_free); + n_item = STORE_RHEAD(nameram_store); + while (n_item) { + DATA_NAMERAM(nameram, n_item); + snprintf(tmp, sizeof(tmp), "rem:%d=%d%c", + rows, (int)sizeof(nameram->rem), FLDSEP); + APPEND_REALLOC(buf, off, len, tmp); + snprintf(tmp, sizeof(tmp), "left:%d=%d%c", + rows, (int)(nameram->left), FLDSEP); + APPEND_REALLOC(buf, off, len, tmp); + n_item = n_item->next; + rows++; + } + K_RUNLOCK(nameram_free); + snprintf(tmp, sizeof(tmp), "flds=%s%c", "rem,left", FLDSEP); + APPEND_REALLOC(buf, off, len, tmp); + snprintf(tmp, sizeof(tmp), "arn=%s%carp=%s%c", + "NameRAM", FLDSEP, "", FLDSEP); + APPEND_REALLOC(buf, off, len, tmp); + ok = true; } else { free(buf);