本文整理汇总了C#中Data.Free方法的典型用法代码示例。如果您正苦于以下问题:C# Data.Free方法的具体用法?C# Data.Free怎么用?C# Data.Free使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.Free方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Put
private bool Put(object key, object value, uint flags) {
Data dkey = new Data(), dvalue = new Data();
try {
dkey = Data.New(key, binfmt, KeyType);
dvalue = Data.New(value, binfmt, ValueType);
int ret = funcs.put(dbp, env.Txn, ref dkey, ref dvalue, flags);
if (ret == DB_KEYEXIST) { return false; }
CheckError(ret);
return true;
} finally {
dkey.Free();
dvalue.Free();
}
}
示例2: Get
public object Get(object key) {
Data dkey = new Data();
Data dvalue = Data.New();
try {
dkey = Data.New(key, binfmt, KeyType);
int ret = funcs.get(dbp, env.Txn, ref dkey, ref dvalue, 0);
if (ret == DB_NOTFOUND || ret == DB_KEYEMPTY)
return null;
CheckError(ret);
return dvalue.GetObject(binfmt, ValueType);
} finally {
dkey.Free();
dvalue.Free();
}
}
示例3: MoveTo
private object MoveTo(object key, object value, bool usevalue) {
Data dkey = new Data();
Data dvalue = new Data();
try {
dkey = Data.New(key, parent.binfmt, parent.KeyType);
if (!usevalue)
dvalue = Data.New();
else
dvalue = Data.New(value, parent.binfmt, parent.ValueType);
int ret = funcs.get(cursorp, ref dkey, ref dvalue, !usevalue ? DB_SET : DB_GET_BOTH);
if (ret == DB_NOTFOUND || ret == DB_KEYEMPTY)
return null;
CheckError(ret);
if (usevalue)
return value;
return dvalue.GetObject(parent.binfmt, parent.ValueType);
} finally {
dkey.Free();
dvalue.Free();
}
}
示例4: Put
public void Put(object key, object value, Dest putwhere) {
Data dkey = new Data(), dvalue = new Data();
uint recno = 0;
try {
if (key != null && parent.KeyType != DataType.UInt)
dkey = Data.New(key, parent.binfmt, parent.KeyType);
else if (parent.KeyType == DataType.UInt) {
recno = (uint) key;
dkey = new Data ();
dkey.flags = Data.DB_DBT_USERMEM;
dkey.Size = sizeof (uint);
dkey.ulen = dkey.Size;
unsafe {
dkey.Ptr = new IntPtr (&recno);
}
}
else
dkey = new Data(); // for putwhere == Current
dvalue = Data.New(value, parent.binfmt, parent.ValueType);
int ret = funcs.put(cursorp, ref dkey, ref dvalue, (uint)putwhere);
if (ret == DB_KEYEXIST) { return; }
CheckError(ret);
} finally {
dkey.Free();
dvalue.Free();
}
}