more TDB
This commit is contained in:
parent
9f9c7120bc
commit
07f6afe73e
|
@ -125,6 +125,7 @@ int tdbPageDestroy(SPage *pPage, void (*xFree)(void *arg, void *ptr), void *arg)
|
|||
int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell) {
|
||||
int ret;
|
||||
SCell *pTarget;
|
||||
u8 *pTmp;
|
||||
|
||||
if (pPage->nOverflow || szCell + pPage->szOffset > pPage->nFree) {
|
||||
// TODO: Page is full
|
||||
|
@ -136,8 +137,9 @@ int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell) {
|
|||
}
|
||||
|
||||
memcpy(pTarget, pCell, szCell);
|
||||
// TODO: memmove();
|
||||
TDB_PAGE_CELL_OFFSET_AT_SET(pPage, idx, pCell - pPage->pData);
|
||||
pTmp = pPage->pCellIdx + idx + pPage->szOffset;
|
||||
memmove(pTmp, pTmp + pPage->szOffset, pPage->pFreeStart - pTmp - pPage->szOffset);
|
||||
TDB_PAGE_CELL_OFFSET_AT_SET(pPage, idx, pTarget - pPage->pData);
|
||||
TDB_PAGE_NCELLS_SET(pPage, TDB_PAGE_NCELLS(pPage) + 1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue