refact some code
This commit is contained in:
parent
4c847cde6b
commit
e73b4a68bb
|
@ -84,31 +84,28 @@ void tLDataIterNextBlock(SLDataIter *pIter) {
|
||||||
int32_t tLDataIterNextRow(SLDataIter *pIter) {
|
int32_t tLDataIterNextRow(SLDataIter *pIter) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
|
int32_t iBlockL = pIter->iBlockL;
|
||||||
if (pIter->backward) {
|
if (pIter->backward) {
|
||||||
pIter->iRow--;
|
pIter->iRow--;
|
||||||
if (pIter->iRow < 0) {
|
if (pIter->iRow < 0) {
|
||||||
pIter->iBlockL--;
|
tLDataIterNextBlock(pIter);
|
||||||
|
|
||||||
if (pIter->iBlockL >= 0) {
|
|
||||||
code = tsdbReadLastBlockEx(pIter->pReader, pIter->iLast, taosArrayGet(pIter->aBlockL, pIter->iBlockL),
|
|
||||||
&pIter->bData);
|
|
||||||
if (code) goto _exit;
|
|
||||||
} else {
|
|
||||||
// TODO: no more data here
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pIter->iRow++;
|
pIter->iRow++;
|
||||||
if (pIter->iRow >= pIter->bData.nRow) {
|
if (pIter->iRow >= pIter->bData.nRow) {
|
||||||
pIter->iBlockL++;
|
pIter->iBlockL++;
|
||||||
if (pIter->iBlockL < taosArrayGetSize(pIter->aBlockL)) {
|
tLDataIterNextBlock(pIter);
|
||||||
code = tsdbReadLastBlockEx(pIter->pReader, pIter->iLast, taosArrayGet(pIter->aBlockL, pIter->iBlockL),
|
}
|
||||||
&pIter->bData);
|
}
|
||||||
if (code) goto _exit;
|
|
||||||
} else {
|
if (iBlockL != pIter->iBlockL) {
|
||||||
// TODO: not more data
|
if (pIter->pBlockL) {
|
||||||
goto _exit;
|
code = tsdbReadLastBlockEx(pIter->pReader, pIter->iLast, pIter->pBlockL, &pIter->bData);
|
||||||
}
|
if (code) goto _exit;
|
||||||
|
pIter->iRow = 0;
|
||||||
|
} else {
|
||||||
|
// no more data
|
||||||
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue