private mdb_put ( |
||
txn | ||
dbi | uint | |
key | LightningDB.Native.ValueStructure | |
data | LightningDB.Native.ValueStructure | |
flags | PutOptions | |
return | int |
public static int mdb_put(IntPtr txn, uint dbi, ArraySegment <byte> key, ArraySegment <byte> value, PutOptions flags) { fixed(byte *pKey = key.Array) fixed(byte *pValue = value.Array) { var k = new mdb_val(key.Count, pKey + key.Offset); var v = new mdb_val(value.Count, pValue + value.Offset); return(check(LmdbMethods.mdb_put(txn, dbi, ref k, ref v, flags))); } }
public static unsafe int mdb_put(IntPtr txn, uint dbi, ReadOnlySpan <byte> key, ReadOnlySpan <byte> value, PutOptions flags) { fixed(byte *addKey = &key.GetPinnableReference(), addVal = &value.GetPinnableReference()) { var keyVs = new ValueStructure { size = new IntPtr(key.Length), data = new IntPtr(addKey), }; var valueVs = new ValueStructure { size = new IntPtr(value.Length), data = new IntPtr(addVal), }; return(check(LmdbMethods.mdb_put(txn, dbi, ref keyVs, ref valueVs, flags))); } }
public static int mdb_put(IntPtr txn, uint dbi, byte[] key, byte[] value, PutOptions flags) { using (var marshal = new MarshalValueStructure(key, value)) return(check(LmdbMethods.mdb_put(txn, dbi, ref marshal.Key, ref marshal.Value, flags))); }
public static MDBResultCode mdb_put(IntPtr txn, uint dbi, MDBValue key, MDBValue value, PutOptions flags) { return(LmdbMethods.mdb_put(txn, dbi, ref key, ref value, flags)); }