c#

位置:IT落伍者 >> c# >> 浏览文章

C#使用BerkeleyDB操作简介[4]


发布日期:2020年06月17日
 
C#使用BerkeleyDB操作简介[4]

}

if (dataBufferLength < dataSize)

{

dataStreamSetLength(dataSize);

data = DbEntryOut(dataStreamGetBuffer());

}

continue;

case ReadStatusSuccess:

dataStreamPosition = ;

dataStreamSetLength(dataSize);

cust = (IPut)formatterDeserialize(dataStream);

return true;

default:

return false;

}

} while (true);

}

完整操作封装

public interface IPut

{

string Key { get; }

}

public class BDBManager : IDisposable

{

/// <summary>

/// 数据库目录

/// </summary>

private string directory;

/// <summary>

/// 数据库文件名

/// </summary>

private string dbName;

private DbBTree btree;

private Txn txn;

private Db db;

private Env env;

/// <summary>

/// 二进制序列化

/// </summary>

private BinaryFormatter formatter;

/// <summary>

/// 键内存流

/// </summary>

private MemoryStream keyStream;

/// <summary>

/// 内容内存流

/// </summary>

private MemoryStream dataStream;

public BDBManager(string directory string dbName)

{

thisdirectory = directory;

thisdbName = dbName;

Init();

StreamInit();

}

public bool Set(IPut put)

{

Reset();

[] [] [] [] [] [] []

               

上一篇:C#使用BerkeleyDB操作简介[5]

下一篇:C#使用BerkeleyDB操作简介[6]