提交 61e6faaf 编写于 作者: H Hongze Cheng

more

上级 815233ae
......@@ -25,8 +25,13 @@ struct SBTree {
struct SBtCursor {
SBTree *pBt;
int8_t iPage;
};
typedef struct SBPage {
/* TODO */
} SBPage;
int tdbBtreeOpen(SPgno root, SBTree **ppBt) {
*ppBt = NULL;
/* TODO */
......@@ -38,6 +43,25 @@ int tdbBtreeClose(SBTree *pBt) {
return 0;
}
int tdbBtreeCursor(SBTree *pBt, SBtCursor *pCur) {
pCur->pBt = pBt;
pCur->iPage = -1;
return 0;
}
int tdbBtreeCursorMoveTo(SBtCursor *pCur) {
/* TODO */
return 0;
}
static int tdbBtreeCursorMoveToRoot(SBtCursor *pCur) {
SPFile *pFile = pCur->pBt->pFile;
tdbPFileGet(pFile, pCur->pBt->root);
/* TODO */
return 0;
}
#if 0
struct SBtCursor {
SBTree *pBtree;
......
......@@ -70,6 +70,19 @@ int tdbPFileClose(SPFile *pFile) {
return 0;
}
SPgHdr *tdbPFileGet(SPFile *pFile, SPgno pgno) {
SPCache *pCache;
SPgid pgid;
SPgHdr * pPage;
pCache = pFile->pCache;
pPage = tdbPCacheFetch(pCache, &pgid, true);
tdbPCacheFetchFinish(pCache, pPage);
return pPage;
}
int tdbPFileBegin(SPFile *pFile) {
// TODO
return 0;
......
......@@ -24,7 +24,7 @@ typedef struct SPFile SPFile;
int tdbPFileOpen(SPCache *pCache, const char *fileName, SPFile **ppFile);
int tdbPFileClose(SPFile *pFile);
void *tdbPFileGet(SPFile *pFile, SPgno pgno);
SPgHdr *tdbPFileGet(SPFile *pFile, SPgno pgno);
int tdbPFileBegin(SPFile *pFile);
int tdbPFileCommit(SPFile *pFile);
int tdbPFileRollback(SPFile *pFile);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册