diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 3c079b1b26fe697b469607c0374550d48c084bc8..11c293af74ccba2ccab4739e85e30492e028d525 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -63,7 +63,7 @@ static int tdbBtCursorMoveToRoot(SBtCursor *pCur); static int tdbInitBtPage(SPage *pPage, SBtPage **ppBtPage); static int tdbCompareKeyAndCell(const void *pKey, int kLen, const void *pCell); -int tdbBtreeOpen(SPgno root, SBTree **ppBt) { +int tdbBtreeOpen(SBTree **ppBt) { *ppBt = NULL; /* TODO */ return 0; diff --git a/source/libs/tdb/src/db/tdbDb.c b/source/libs/tdb/src/db/tdbDb.c index e5c6e19163df423f3c0dcae8864370eb6b82ff50..a0c9939ad92b3fba6307fe1f6235572b1b9d3b99 100644 --- a/source/libs/tdb/src/db/tdbDb.c +++ b/source/libs/tdb/src/db/tdbDb.c @@ -23,6 +23,7 @@ struct STDb { int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, STEnv *pEnv, STDb **ppDb) { STDb * pDb; SPFile *pFile; + int ret; *ppDb = NULL; @@ -31,8 +32,15 @@ int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprF return -1; } + // pDb->pEnv pDb->pEnv = pEnv; + // pDb->pBt + ret = tdbBtreeOpen(&(pDb->pBt)); + if (ret < 0) { + return -1; + } + *ppDb = pDb; return 0; } diff --git a/source/libs/tdb/src/inc/tdbBtree.h b/source/libs/tdb/src/inc/tdbBtree.h index a2890b4cd4c50c3d6ce9555a7eec92cf2bbaefb8..0961ac1664bd16a8b968480c551ec4f0a8c96a98 100644 --- a/source/libs/tdb/src/inc/tdbBtree.h +++ b/source/libs/tdb/src/inc/tdbBtree.h @@ -23,6 +23,8 @@ extern "C" { typedef struct SBTree SBTree; typedef struct SBtCursor SBtCursor; +int tdbBtreeOpen(SBTree **ppBt); +int tdbBtreeClose(SBTree *pBt); int tdbBtCursorInsert(SBtCursor *pCur, const void *pKey, int kLen, const void *pVal, int vLen); #ifdef __cplusplus