提交 07f6afe7 编写于 作者: H Hongze Cheng

more TDB

上级 9f9c7120
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册