Browse Source

ckdb - add msgline to cmd_dsp() code

master
kanoi 8 years ago
parent
commit
62c7fce61e
  1. 1
      src/ckdb.c
  2. 3
      src/ckdb.h
  3. 3
      src/ckdb_cmd.c
  4. 31
      src/ckdb_data.c

1
src/ckdb.c

@ -2023,6 +2023,7 @@ static void alloc_storage()
msgline_free = k_new_list("MsgLine", sizeof(MSGLINE), msgline_free = k_new_list("MsgLine", sizeof(MSGLINE),
ALLOC_MSGLINE, LIMIT_MSGLINE, true); ALLOC_MSGLINE, LIMIT_MSGLINE, true);
msgline_store = k_new_store(msgline_free); msgline_store = k_new_store(msgline_free);
msgline_free->dsp_func = dsp_msgline;
workqueue_free = k_new_list("WorkQueue", sizeof(WORKQUEUE), workqueue_free = k_new_list("WorkQueue", sizeof(WORKQUEUE),
ALLOC_WORKQUEUE, LIMIT_WORKQUEUE, true); ALLOC_WORKQUEUE, LIMIT_WORKQUEUE, true);

3
src/ckdb.h

@ -58,7 +58,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.7" #define DB_VERSION "1.0.7"
#define CKDB_VERSION DB_VERSION"-2.512" #define CKDB_VERSION DB_VERSION"-2.513"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@ -3333,6 +3333,7 @@ extern INTRANSIENT *_get_intransient(const char *fldnam, char *value,
#define intransient_str(_fld, _val) \ #define intransient_str(_fld, _val) \
_intransient_str(_fld, _val, WHERE_FFL_HERE) _intransient_str(_fld, _val, WHERE_FFL_HERE)
extern char *_intransient_str(char *fldnam, char *value, WHERE_FFL_ARGS); extern char *_intransient_str(char *fldnam, char *value, WHERE_FFL_ARGS);
extern void dsp_msgline(K_ITEM *item, FILE *stream);
extern char *_transfer_data(K_ITEM *item, WHERE_FFL_ARGS); extern char *_transfer_data(K_ITEM *item, WHERE_FFL_ARGS);
extern void dsp_transfer(K_ITEM *item, FILE *stream); extern void dsp_transfer(K_ITEM *item, FILE *stream);
extern cmp_t cmp_transfer(K_ITEM *a, K_ITEM *b); extern cmp_t cmp_transfer(K_ITEM *a, K_ITEM *b);

3
src/ckdb_cmd.c

@ -5966,6 +5966,9 @@ static char *cmd_dsp(__maybe_unused PGconn *conn, __maybe_unused char *cmd,
if (strcasecmp(name, "markersummary") == 0) if (strcasecmp(name, "markersummary") == 0)
dsp_kstore(markersummary_store, fil, NULL); dsp_kstore(markersummary_store, fil, NULL);
if (strcasecmp(name, "msgline") == 0)
dsp_kstore(msgline_store, fil, NULL);
} }
LOGDEBUG("%s.ok.dsp.file='%s'", id, fil); LOGDEBUG("%s.ok.dsp.file='%s'", id, fil);

31
src/ckdb_data.c

@ -816,6 +816,37 @@ char *_intransient_str(char *fldnam, char *value, WHERE_FFL_ARGS)
return in->str; return in->str;
} }
void dsp_msgline(K_ITEM *item, FILE *stream)
{
K_ITEM *t_item;
MSGLINE *m;
int c;
if (!item)
fprintf(stream, "%s() called with (null) item\n", __func__);
else {
DATA_MSGLINE(m, item);
if (m->trf_store)
c = m->trf_store->count;
else
c = 0;
fprintf(stream, " which=%d id='%s' cmd='%s' msg='%.42s' "
"trf_store=%c count=%d\n",
m->which_cmds, m->id, m->cmd, m->msg,
m->trf_store ? 'Y' : 'N', c);
if (m->trf_store) {
t_item = m->trf_store->head;
while (t_item) {
fputc(' ', stream);
dsp_transfer(t_item, stream);
t_item = t_item->next;
}
}
}
}
// For mutiple variable function calls that need the data // For mutiple variable function calls that need the data
char *_transfer_data(K_ITEM *item, WHERE_FFL_ARGS) char *_transfer_data(K_ITEM *item, WHERE_FFL_ARGS)
{ {

Loading…
Cancel
Save