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

more

上级 815233ae
...@@ -25,8 +25,13 @@ struct SBTree { ...@@ -25,8 +25,13 @@ struct SBTree {
struct SBtCursor { struct SBtCursor {
SBTree *pBt; SBTree *pBt;
int8_t iPage;
}; };
typedef struct SBPage {
/* TODO */
} SBPage;
int tdbBtreeOpen(SPgno root, SBTree **ppBt) { int tdbBtreeOpen(SPgno root, SBTree **ppBt) {
*ppBt = NULL; *ppBt = NULL;
/* TODO */ /* TODO */
...@@ -38,6 +43,25 @@ int tdbBtreeClose(SBTree *pBt) { ...@@ -38,6 +43,25 @@ int tdbBtreeClose(SBTree *pBt) {
return 0; 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 #if 0
struct SBtCursor { struct SBtCursor {
SBTree *pBtree; SBTree *pBtree;
......
...@@ -70,6 +70,19 @@ int tdbPFileClose(SPFile *pFile) { ...@@ -70,6 +70,19 @@ int tdbPFileClose(SPFile *pFile) {
return 0; 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) { int tdbPFileBegin(SPFile *pFile) {
// TODO // TODO
return 0; return 0;
......
...@@ -22,12 +22,12 @@ extern "C" { ...@@ -22,12 +22,12 @@ extern "C" {
typedef struct SPFile SPFile; typedef struct SPFile SPFile;
int tdbPFileOpen(SPCache *pCache, const char *fileName, SPFile **ppFile); int tdbPFileOpen(SPCache *pCache, const char *fileName, SPFile **ppFile);
int tdbPFileClose(SPFile *pFile); int tdbPFileClose(SPFile *pFile);
void *tdbPFileGet(SPFile *pFile, SPgno pgno); SPgHdr *tdbPFileGet(SPFile *pFile, SPgno pgno);
int tdbPFileBegin(SPFile *pFile); int tdbPFileBegin(SPFile *pFile);
int tdbPFileCommit(SPFile *pFile); int tdbPFileCommit(SPFile *pFile);
int tdbPFileRollback(SPFile *pFile); int tdbPFileRollback(SPFile *pFile);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册