refactor:fix error data incomplete if dataformat=true
This commit is contained in:
parent
65c77f572a
commit
2e25f684a4
|
@ -148,8 +148,8 @@ static int32_t smlBuildInvalidDataMsg(SSmlMsgBuf* pBuf, const char *msg1, const
|
|||
}
|
||||
|
||||
static int smlCompareKv(const void* p1, const void* p2) {
|
||||
SSmlKv* kv1 = (SSmlKv*)p1;
|
||||
SSmlKv* kv2 = (SSmlKv*)p2;
|
||||
SSmlKv* kv1 = *(SSmlKv**)p1;
|
||||
SSmlKv* kv2 = *(SSmlKv**)p2;
|
||||
int32_t kvLen1 = kv1->keyLen;
|
||||
int32_t kvLen2 = kv2->keyLen;
|
||||
int32_t res = strncasecmp(kv1->key, kv2->key, TMIN(kvLen1, kvLen2));
|
||||
|
|
|
@ -1707,7 +1707,7 @@ int32_t smlBindData(void *handle, SArray *tags, SArray *colsFormat, SArray *cols
|
|||
}
|
||||
|
||||
// 1. set the parsed value from sql string
|
||||
for (int c = 0; c < spd->numOfBound; ++c) {
|
||||
for (int c = 0, j = 0; c < spd->numOfBound; ++c) {
|
||||
SSchema* pColSchema = &pSchema[spd->boundColumns[c] - 1];
|
||||
|
||||
param.schema = pColSchema;
|
||||
|
@ -1715,20 +1715,14 @@ int32_t smlBindData(void *handle, SArray *tags, SArray *colsFormat, SArray *cols
|
|||
|
||||
SSmlKv *kv = NULL;
|
||||
if(format){
|
||||
do{
|
||||
if(rowDataSize >= c){
|
||||
break;
|
||||
if(j < rowDataSize){
|
||||
kv = taosArrayGetP(rowData, j);
|
||||
if (rowDataSize != spd->numOfBound && (kv->keyLen != strlen(pColSchema->name) || strncmp(kv->key, pColSchema->name, kv->keyLen) != 0)){
|
||||
kv = NULL;
|
||||
}else{
|
||||
j++;
|
||||
}
|
||||
kv = taosArrayGetP(rowData, c);
|
||||
if (rowDataSize != spd->numOfBound && kv && (kv->keyLen != strlen(pColSchema->name) || strncmp(kv->key, pColSchema->name, kv->keyLen) != 0)){
|
||||
MemRowAppend(&pBuf, NULL, 0, ¶m);
|
||||
c++;
|
||||
if(c >= spd->numOfBound) break;
|
||||
pColSchema = &pSchema[spd->boundColumns[c] - 1];
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}while(1);
|
||||
}
|
||||
}else{
|
||||
void **p =taosHashGet(rowData, pColSchema->name, strlen(pColSchema->name));
|
||||
if(p) kv = *p;
|
||||
|
|
Loading…
Reference in New Issue