提交 4ac1fca0 编写于 作者: H Hongze Cheng

more TDB

上级 c908f178
...@@ -294,10 +294,10 @@ static int tdbBtreeOpenImpl(SBTree *pBt) { ...@@ -294,10 +294,10 @@ static int tdbBtreeOpenImpl(SBTree *pBt) {
} }
// Try to create a new database // Try to create a new database
ret = tdbPagerNewPage(pBt->pPager, &pgno, &pPage); // ret = tdbPagerNewPage(pBt->pPager, &pgno, &pPage);
if (ret < 0) { // if (ret < 0) {
return -1; // return -1;
} // }
ASSERT(pgno != 0); ASSERT(pgno != 0);
pBt->root = pgno; pBt->root = pgno;
......
...@@ -227,7 +227,7 @@ static int tdbPagerReadPage(SPager *pPager, SPage *pPage) { ...@@ -227,7 +227,7 @@ static int tdbPagerReadPage(SPager *pPager, SPage *pPage) {
int tdbPagerGetPageSize(SPager *pPager) { return pPager->pageSize; } int tdbPagerGetPageSize(SPager *pPager) { return pPager->pageSize; }
int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage) { int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage, int (*initPage)(SPage *, void *), void *arg) {
SPage *pPage; SPage *pPage;
SPgid pgid; SPgid pgid;
int ret; int ret;
...@@ -251,10 +251,10 @@ int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage) { ...@@ -251,10 +251,10 @@ int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage) {
return -1; return -1;
} }
// ret = (*initPage)(pPage); ret = (*initPage)(pPage, arg);
// if (ret < 0) { if (ret < 0) {
// return -1; return -1;
// } }
pPage->pPager = pPager; pPage->pPager = pPager;
} }
...@@ -268,7 +268,7 @@ int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage) { ...@@ -268,7 +268,7 @@ int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage) {
return 0; return 0;
} }
int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage) { int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPage)(SPage *, void *), void *arg) {
int ret; int ret;
SPage *pPage; SPage *pPage;
SPgid pgid; SPgid pgid;
...@@ -296,7 +296,7 @@ int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage) { ...@@ -296,7 +296,7 @@ int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage) {
// tdbWLockPage(pPage); // tdbWLockPage(pPage);
// TODO: zero init the new page // TODO: zero init the new page
// (*initNewPage)(pPage, arg); (*initPage)(pPage, arg);
pPage->pPager = NULL; pPage->pPager = NULL;
......
...@@ -28,8 +28,8 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage); ...@@ -28,8 +28,8 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage);
int tdbPagerBegin(SPager *pPager); int tdbPagerBegin(SPager *pPager);
int tdbPagerCommit(SPager *pPager); int tdbPagerCommit(SPager *pPager);
int tdbPagerGetPageSize(SPager *pPager); int tdbPagerGetPageSize(SPager *pPager);
int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage); int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage, int (*initPage)(SPage *, void *), void *arg);
int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage); int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPage)(SPage *, void *), void *arg);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册