more code
This commit is contained in:
parent
0d39f49d28
commit
b840cd3f34
|
@ -1762,6 +1762,19 @@ _exit:
|
||||||
int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind) {
|
int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
|
ASSERT(pColData->type == pBind->buffer_type);
|
||||||
|
|
||||||
|
if (IS_VAR_DATA_TYPE(pBind->buffer_type)) { // var-length data type
|
||||||
|
for (int32_t i = 0; i < pBind->num; ++i) {
|
||||||
|
if (pBind->is_null && pBind->is_null[i]) {
|
||||||
|
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0);
|
||||||
|
if (code) goto _exit;
|
||||||
|
} else {
|
||||||
|
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](
|
||||||
|
pColData, (uint8_t *)pBind->buffer + pBind->buffer_length * i, pBind->length[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // fixed-length data type
|
||||||
bool allValue;
|
bool allValue;
|
||||||
bool allNull;
|
bool allNull;
|
||||||
if (pBind->is_null) {
|
if (pBind->is_null) {
|
||||||
|
@ -1773,44 +1786,18 @@ int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind) {
|
||||||
allValue = true;
|
allValue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pColData->nVal += pBind->num;
|
if (allValue) {
|
||||||
if (IS_VAR_DATA_TYPE(pBind->buffer_type)) { // var-length data type
|
// todo
|
||||||
|
} else if (allNull) {
|
||||||
|
// todo
|
||||||
|
} else {
|
||||||
for (int32_t i = 0; i < pBind->num; ++i) {
|
for (int32_t i = 0; i < pBind->num; ++i) {
|
||||||
if (pBind->is_null[i]) {
|
if (pBind->is_null[i]) {
|
||||||
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0);
|
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0);
|
||||||
if (code) goto _exit;
|
if (code) goto _exit;
|
||||||
} else {
|
} else {
|
||||||
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](
|
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](
|
||||||
pColData, (uint8_t *)pBind->buffer + pBind->buffer_length * i, pBind->length[i]);
|
pColData, (uint8_t *)pBind->buffer + TYPE_BYTES[pColData->type] * i, pBind->buffer_length);
|
||||||
}
|
|
||||||
}
|
|
||||||
} else { // fixed-length data type
|
|
||||||
pColData->nVal += pBind->num;
|
|
||||||
|
|
||||||
if (allValue) {
|
|
||||||
pColData->flag |= HAS_VALUE;
|
|
||||||
if (pColData->flag != HAS_VALUE) {
|
|
||||||
// todo
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t nData = pColData->nData + TYPE_BYTES[pBind->buffer_type] * pBind->num;
|
|
||||||
code = tRealloc(&pColData->pData, nData);
|
|
||||||
if (code) goto _exit;
|
|
||||||
|
|
||||||
memcpy(pColData->pData + pColData->nData, pBind->buffer, nData - pColData->nData);
|
|
||||||
pColData->nData = nData;
|
|
||||||
} else if (allNull) {
|
|
||||||
pColData->flag |= HAS_NULL;
|
|
||||||
|
|
||||||
// todo
|
|
||||||
|
|
||||||
} else {
|
|
||||||
for (int32_t i = 0; i < pBind->num; ++i) {
|
|
||||||
if (pBind->is_null[i]) {
|
|
||||||
code = tColDataAppendValue(pColData, &COL_VAL_NULL(pColData->cid, pColData->type));
|
|
||||||
// tColDataAppendNull(pColData);
|
|
||||||
} else {
|
|
||||||
uint8_t *pData = (uint8_t *)pBind->buffer + TYPE_BYTES[pBind->buffer_type] * i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue