提交 2030bdab 编写于 作者: H Hongze Cheng

more

上级 7cd83134
......@@ -29,8 +29,8 @@ struct SBTree {
typedef struct SPgHdr {
u8 flags;
u8 nFree;
u16 firstFree;
u8 fragmentTotalSize;
u16 firstFreeCellOffset;
u16 nCells;
u16 pCell;
i32 kLen;
......@@ -48,6 +48,10 @@ struct SBtCursor {
SBTree * pBt;
i8 iPage;
SBtPage *pPage;
u16 idx;
u16 idxStack[BTREE_MAX_DEPTH + 1];
SBtPage *pgStack[BTREE_MAX_DEPTH + 1];
void * pBuf;
};
typedef struct SFreeCell {
......@@ -72,16 +76,19 @@ int tdbBtreeClose(SBTree *pBt) {
return 0;
}
int tdbBtreeCursor(SBTree *pBt, SBtCursor *pCur) {
int tdbBtreeCursor(SBtCursor *pCur, SBTree *pBt) {
pCur->pBt = pBt;
pCur->iPage = -1;
/* TODO */
pCur->pPage = NULL;
pCur->idx = 0;
return 0;
}
int tdbBtCursorInsert(SBtCursor *pCur, const void *pKey, int kLen, const void *pVal, int vLen) {
int ret;
SPFile *pFile;
int ret;
SPFile * pFile;
SBtPage *pPage;
ret = tdbBtCursorMoveTo(pCur, pKey, kLen);
if (ret < 0) {
......@@ -89,12 +96,7 @@ int tdbBtCursorInsert(SBtCursor *pCur, const void *pKey, int kLen, const void *p
return -1;
}
pFile = pCur->pBt->pFile;
// ret = tdbPFileWrite(pFile, pCur->pPage);
// if (ret < 0) {
// // TODO: handle error
// return -1;
// }
pPage = pCur->pPage;
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册