提交 c5618796 编写于 作者: H Hongze Cheng

more TDB

上级 c1e556e7
......@@ -172,6 +172,11 @@ int tdbGetDup(TDB *pDb) {
}
}
int tdbInsert(TDB *pDb, const void *pKey, int nKey, const void *pData, int nData) {
// TODO
return 0;
}
static int tdbDefaultKeyCmprFn(int keyLen1, const void *pKey1, int keyLen2, const void *pKey2) {
int mlen;
int cret;
......
......@@ -22,6 +22,10 @@ typedef struct SPage1 {
uint32_t nFree; // number of free pages
} SPage1;
typedef struct SFreePage {
/* TODO */
} SFreePage;
TDB_STATIC_ASSERT(sizeof(SPage1) <= TDB_MIN_PGSIZE, "TDB Page1 definition too large");
static int pgFileRead(SPgFile *pPgFile, pgno_t pgno, uint8_t *pData);
......
......@@ -3,7 +3,7 @@
#include "tdb.h"
TEST(tdb_test, simple_test) {
TENV* pEnv;
TENV * pEnv;
TDB * pDb1, *pDb2, *pDb3;
pgsz_t pgSize = 1024;
cachesz_t cacheSize = 10240;
......@@ -20,14 +20,12 @@ TEST(tdb_test, simple_test) {
GTEST_ASSERT_EQ(tdbEnvOpen(pEnv), 0);
#if 1
tdbEnvBeginTxn(pEnv);
// DB
GTEST_ASSERT_EQ(tdbCreate(&pDb1), 0);
GTEST_ASSERT_EQ(tdbSetKeyLen(pDb1, 8), 0);
// GTEST_ASSERT_EQ(tdbSetKeyLen(pDb1, 8), 0);
GTEST_ASSERT_EQ(tdbGetKeyLen(pDb1), 8);
// GTEST_ASSERT_EQ(tdbGetKeyLen(pDb1), 8);
// GTEST_ASSERT_EQ(tdbSetValLen(pDb1, 3), 0);
......@@ -39,8 +37,14 @@ TEST(tdb_test, simple_test) {
// GTEST_ASSERT_EQ(tdbSetCmprFunc(pDb1, NULL), 0);
tdbEnvBeginTxn(pEnv);
GTEST_ASSERT_EQ(tdbOpen(pDb1, "db.db", "db1", pEnv), 0);
// char *key = "key1";
// char *val = "value1";
// tdbInsert(pDb1, (void *)key, strlen(key), (void *)val, strlen(val));
tdbEnvCommit(pEnv);
#if 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册