[td-11818] Fix bug in jsonToObj
This commit is contained in:
parent
7f53f2d1a0
commit
b6bd41d99e
|
@ -49,7 +49,7 @@ int main(int argc, char** argv) {
|
|||
TEST(testCase, driverInit_Test) { taos_init(); }
|
||||
|
||||
TEST(testCase, connect_Test) {
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", "abc1", 0);
|
||||
if (pConn == NULL) {
|
||||
printf("failed to connect to server, reason:%s\n", taos_errstr(NULL));
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ static void copyString(const cJSON* json, const char* name, char* dst) {
|
|||
}
|
||||
|
||||
static int64_t getNumber(const cJSON* json, const char* name) {
|
||||
return cJSON_GetNumberValue(cJSON_GetObjectItem(json, name));
|
||||
double d = cJSON_GetNumberValue(cJSON_GetObjectItem(json, name));
|
||||
return (int64_t) d;
|
||||
}
|
||||
|
||||
static bool addObject(cJSON* json, const char* name, FToJson func, const void* obj) {
|
||||
|
@ -541,17 +542,27 @@ static const char* jkTimeWindowEndKey = "EndKey";
|
|||
|
||||
static bool timeWindowToJson(const void* obj, cJSON* json) {
|
||||
const STimeWindow* win = (const STimeWindow*)obj;
|
||||
bool res = cJSON_AddNumberToObject(json, jkTimeWindowStartKey, win->skey);
|
||||
|
||||
char tmp[32] = {0};
|
||||
sprintf(tmp, "%"PRId64, win->skey);
|
||||
|
||||
bool res = cJSON_AddStringToObject(json, jkTimeWindowStartKey, tmp);
|
||||
if (res) {
|
||||
res = cJSON_AddNumberToObject(json, jkTimeWindowEndKey, win->ekey);
|
||||
memset(tmp, 0, tListLen(tmp));
|
||||
sprintf(tmp, "%"PRId64, win->ekey);
|
||||
res = cJSON_AddStringToObject(json, jkTimeWindowEndKey, tmp);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static bool timeWindowFromJson(const cJSON* json, void* obj) {
|
||||
STimeWindow* win = (STimeWindow*)obj;
|
||||
win->skey = getNumber(json, jkTimeWindowStartKey);
|
||||
win->ekey = getNumber(json, jkTimeWindowEndKey);
|
||||
|
||||
char* p = getString(json, jkTimeWindowStartKey);
|
||||
win->skey = strtoll(p, NULL, 10);
|
||||
|
||||
p = getString(json, jkTimeWindowEndKey);
|
||||
win->ekey = strtoll(p, NULL, 10);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1262,6 +1262,7 @@ int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
|
|||
}
|
||||
|
||||
QW_ERR_JRET(qwAddTask(qWorkerMgmt, sId, qId, tId, JOB_TASK_STATUS_EXECUTING));
|
||||
QW_DLOG("query task received, reqId:0x%"PRIx64", physical plan:%s", qId, msg->msg);
|
||||
|
||||
code = qStringToSubplan(msg->msg, &plan);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
|
|
Loading…
Reference in New Issue