fix type convert
This commit is contained in:
parent
285dc21755
commit
cf33a822b9
|
@ -163,12 +163,13 @@ void basic_consume_loop(tmq_t* tmq, tmq_list_t* topics) {
|
|||
printf("subscribe err\n");
|
||||
return;
|
||||
}
|
||||
/*int32_t cnt = 0;*/
|
||||
int32_t cnt = 0;
|
||||
/*clock_t startTime = clock();*/
|
||||
while (running) {
|
||||
tmq_message_t* tmqmessage = tmq_consumer_poll(tmq, 500);
|
||||
if (tmqmessage) {
|
||||
/*cnt++;*/
|
||||
cnt++;
|
||||
printf("get data\n");
|
||||
msg_process(tmqmessage);
|
||||
tmq_message_destroy(tmqmessage);
|
||||
/*} else {*/
|
||||
|
|
|
@ -194,14 +194,13 @@ enum {
|
|||
#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY)
|
||||
#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ)
|
||||
|
||||
struct tmq_message_t {
|
||||
int8_t resType;
|
||||
SMqPollRsp msg;
|
||||
char* topic;
|
||||
void* vg;
|
||||
SArray* res; // SArray<SReqResultInfo>
|
||||
int32_t resIter;
|
||||
};
|
||||
typedef struct SMqRspObj {
|
||||
int8_t resType;
|
||||
char* topic;
|
||||
void* vg;
|
||||
SArray* res; // SArray<SReqResultInfo>
|
||||
int32_t resIter;
|
||||
} SMqRspObj;
|
||||
|
||||
typedef struct SRequestObj {
|
||||
int8_t resType; // query or tmq
|
||||
|
@ -222,13 +221,13 @@ typedef struct SRequestObj {
|
|||
} SRequestObj;
|
||||
|
||||
static FORCE_INLINE SReqResultInfo* tmqGetCurResInfo(TAOS_RES* res) {
|
||||
tmq_message_t* msg = (tmq_message_t*)res;
|
||||
int32_t resIter = msg->resIter == -1 ? 0 : msg->resIter;
|
||||
SMqRspObj* msg = (SMqRspObj*)res;
|
||||
int32_t resIter = msg->resIter == -1 ? 0 : msg->resIter;
|
||||
return (SReqResultInfo*)taosArrayGet(msg->res, resIter);
|
||||
}
|
||||
|
||||
static FORCE_INLINE SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res) {
|
||||
tmq_message_t* msg = (tmq_message_t*)res;
|
||||
SMqRspObj* msg = (SMqRspObj*)res;
|
||||
if (++msg->resIter < taosArrayGetSize(msg->res)) {
|
||||
return (SReqResultInfo*)taosArrayGet(msg->res, msg->resIter);
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
|
|||
return doFetchRow(pRequest, true, true);
|
||||
|
||||
} else if (TD_RES_TMQ(res)) {
|
||||
tmq_message_t *msg = ((tmq_message_t *)res);
|
||||
SMqRspObj *msg = ((SMqRspObj *)res);
|
||||
SReqResultInfo *pResultInfo = taosArrayGet(msg->res, msg->resIter);
|
||||
|
||||
doSetOneRowPtr(pResultInfo);
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
#include "tqueue.h"
|
||||
#include "tref.h"
|
||||
|
||||
struct tmq_message_t {
|
||||
SMqPollRsp msg;
|
||||
char* topic;
|
||||
void* vg;
|
||||
SArray* res; // SArray<SReqResultInfo>
|
||||
int32_t resIter;
|
||||
};
|
||||
|
||||
struct tmq_list_t {
|
||||
SArray container;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue