/// <summary> /// Store by cursor. /// This function stores key/data pairs into the database. /// If the function fails for any reason, the state of the cursor will be unchanged. /// If the function succeeds and an item is inserted into the database, the cursor is always positioned to refer to the newly inserted item. /// </summary> /// <param name="key">The key operated on.</param> /// <param name="value">The data operated on.</param> /// <param name="options"> /// Options for this operation. This parameter must be set to 0 or one of the values described here. /// CursorPutOptions.Current - overwrite the data of the key/data pair to which the cursor refers with the specified data item. The key parameter is ignored. /// CursorPutOptions.NoDuplicateData - enter the new key/data pair only if it does not already appear in the database. This flag may only be specified if the database was opened with MDB_DUPSORT. The function will return MDB_KEYEXIST if the key/data pair already appears in the database. /// CursorPutOptions.NoOverwrite - enter the new key/data pair only if the key does not already appear in the database. The function will return MDB_KEYEXIST if the key already appears in the database, even if the database supports duplicates (MDB_DUPSORT). /// CursorPutOptions.ReserveSpace - reserve space for data of the given size, but don't copy the given data. Instead, return a pointer to the reserved space, which the caller can fill in later. This saves an extra memcpy if the data is being generated later. /// CursorPutOptions.AppendData - append the given key/data pair to the end of the database. No key comparisons are performed. This option allows fast bulk loading when keys are already known to be in the correct order. Loading unsorted keys with this flag will cause data corruption. /// CursorPutOptions.AppendDuplicateData - as above, but for sorted dup data. /// </param> public void Put(byte[] key, byte[] value, CursorPutOptions options) { using (var keyMarshalStruct = new MarshalValueStructure(key)) using (var valueMarshalStruct = new MarshalValueStructure(value)) { var keyStruct = keyMarshalStruct.ValueStructure; var valueStruct = valueMarshalStruct.ValueStructure; NativeMethods.Execute(lib => lib.mdb_cursor_put(_handle, ref keyStruct, ref valueStruct, options)); } }
/// <summary> /// Store by cursor. /// This function stores key/data pairs into the database. The cursor is positioned at the new item, or on failure usually near it. /// Note: Earlier documentation incorrectly said errors would leave the state of the cursor unchanged. /// If the function fails for any reason, the state of the cursor will be unchanged. /// If the function succeeds and an item is inserted into the database, the cursor is always positioned to refer to the newly inserted item. /// </summary> /// <param name="key">The key operated on.</param> /// <param name="value">The data operated on.</param> /// <param name="options"> /// Options for this operation. This parameter must be set to 0 or one of the values described here. /// CursorPutOptions.Current - overwrite the data of the key/data pair to which the cursor refers with the specified data item. The key parameter is ignored. /// CursorPutOptions.NoDuplicateData - enter the new key/data pair only if it does not already appear in the database. This flag may only be specified if the database was opened with MDB_DUPSORT. The function will return MDB_KEYEXIST if the key/data pair already appears in the database. /// CursorPutOptions.NoOverwrite - enter the new key/data pair only if the key does not already appear in the database. The function will return MDB_KEYEXIST if the key already appears in the database, even if the database supports duplicates (MDB_DUPSORT). /// CursorPutOptions.ReserveSpace - reserve space for data of the given size, but don't copy the given data. Instead, return a pointer to the reserved space, which the caller can fill in later. This saves an extra memcpy if the data is being generated later. /// CursorPutOptions.AppendData - append the given key/data pair to the end of the database. No key comparisons are performed. This option allows fast bulk loading when keys are already known to be in the correct order. Loading unsorted keys with this flag will cause data corruption. /// CursorPutOptions.AppendDuplicateData - as above, but for sorted dup data. /// </param> /// <returns>Returns <see cref="MDBResultCode"/></returns> public MDBResultCode Put(byte[] key, byte[] value, CursorPutOptions options) { return(Put(key.AsSpan(), value.AsSpan(), options)); }
/// <summary> /// store multiple contiguous data elements in a single request. /// May only be used with MDB_DUPFIXED. /// </summary> /// <param name="data">This span must be pinned or stackalloc memory</param> public static MDBResultCode mdb_cursor_put(IntPtr cursor, ref MDBValue key, ref Span <MDBValue> data, CursorPutOptions flags) { ref var dataRef = ref MemoryMarshal.GetReference(data);
public static MDBResultCode mdb_cursor_put(IntPtr cursor, MDBValue key, MDBValue value, CursorPutOptions flags) { return(mdb_cursor_put(cursor, ref key, ref value, flags)); }
private static extern int mdb_cursor_put(IntPtr cursor, ref ValueStructure key, ref ValueStructure data, CursorPutOptions flags);
public static int mdb_cursor_put(IntPtr cursor, ref ValueStructure key, ValueStructure[] data, CursorPutOptions flags) { return(check(LmdbMethods.mdb_cursor_put(cursor, ref key, data, flags))); }
int INativeLibraryFacade.mdb_cursor_put(IntPtr cursor, ref ValueStructure key, ValueStructure[] data, CursorPutOptions flags) { return FallbackLibraryFacade.mdb_cursor_put(cursor, ref key, data, flags); }
int INativeLibraryFacade.mdb_cursor_put(IntPtr cursor, ref ValueStructure key, ref ValueStructure data, CursorPutOptions flags) { return Native64BitLibraryFacade.mdb_cursor_put(cursor, ref key, ref data, flags); }
public bool TryPut(ref DirectBuffer key, ref DirectBuffer value, CursorPutOptions options) { return(_impl.TryPut(ref key, ref value, options)); }
public bool TryPut <TKey, TValue>(ref TKey key, ref TValue value, CursorPutOptions options) where TKey : struct where TValue : struct { return(_impl.TryPut(ref key, ref value, options)); }
public static extern MDBResultCode mdb_cursor_put(IntPtr cursor, ref MDBValue key, MDBValue[] value, CursorPutOptions flags);
/// <summary> /// Store by cursor. /// This function stores key/data pairs into the database. /// If the function fails for any reason, the state of the cursor will be unchanged. /// If the function succeeds and an item is inserted into the database, the cursor is always positioned to refer to the newly inserted item. /// </summary> /// <param name="key">The key operated on.</param> /// <param name="value">The data operated on.</param> /// <param name="options"> /// Options for this operation. This parameter must be set to 0 or one of the values described here. /// CursorPutOptions.Current - overwrite the data of the key/data pair to which the cursor refers with the specified data item. The key parameter is ignored. /// CursorPutOptions.NoDuplicateData - enter the new key/data pair only if it does not already appear in the database. This flag may only be specified if the database was opened with MDB_DUPSORT. The function will return MDB_KEYEXIST if the key/data pair already appears in the database. /// CursorPutOptions.NoOverwrite - enter the new key/data pair only if the key does not already appear in the database. The function will return MDB_KEYEXIST if the key already appears in the database, even if the database supports duplicates (MDB_DUPSORT). /// CursorPutOptions.ReserveSpace - reserve space for data of the given size, but don't copy the given data. Instead, return a pointer to the reserved space, which the caller can fill in later. This saves an extra memcpy if the data is being generated later. /// CursorPutOptions.AppendData - append the given key/data pair to the end of the database. No key comparisons are performed. This option allows fast bulk loading when keys are already known to be in the correct order. Loading unsorted keys with this flag will cause data corruption. /// CursorPutOptions.AppendDuplicateData - as above, but for sorted dup data. /// </param> public void Put(byte[] key, byte[] value, CursorPutOptions options) { using(var keyMarshalStruct = new MarshalValueStructure(key)) using (var valueMarshalStruct = new MarshalValueStructure(value)) { var keyStruct = keyMarshalStruct.ValueStructure; var valueStruct = valueMarshalStruct.ValueStructure; NativeMethods.Execute(lib => lib.mdb_cursor_put(_handle, ref keyStruct, ref valueStruct, options)); } }
/// <summary> /// Store by cursor. /// This function stores key/data pairs into the database. /// If the function fails for any reason, the state of the cursor will be unchanged. /// If the function succeeds and an item is inserted into the database, the cursor is always positioned to refer to the newly inserted item. /// </summary> /// <param name="cur">A cursor.</param> /// <param name="key">The key operated on.</param> /// <param name="value">The data operated on.</param> /// <param name="options"> /// Options for this operation. This parameter must be set to 0 or one of the values described here. (optional) /// CursorPutOptions.Current - overwrite the data of the key/data pair to which the cursor refers with the specified data item. The key parameter is ignored. /// CursorPutOptions.NoDuplicateData - enter the new key/data pair only if it does not already appear in the database. This flag may only be specified if the database was opened with MDB_DUPSORT. The function will return MDB_KEYEXIST if the key/data pair already appears in the database. /// CursorPutOptions.NoOverwrite - enter the new key/data pair only if the key does not already appear in the database. The function will return MDB_KEYEXIST if the key already appears in the database, even if the database supports duplicates (MDB_DUPSORT). /// CursorPutOptions.ReserveSpace - reserve space for data of the given size, but don't copy the given data. Instead, return a pointer to the reserved space, which the caller can fill in later. This saves an extra memcpy if the data is being generated later. /// CursorPutOptions.AppendData - append the given key/data pair to the end of the database. No key comparisons are performed. This option allows fast bulk loading when keys are already known to be in the correct order. Loading unsorted keys with this flag will cause data corruption. /// CursorPutOptions.AppendDuplicateData - as above, but for sorted dup data. /// </param> public static void Put <TKey, TValue>(this LightningCursor cur, TKey key, TValue value, CursorPutOptions options = CursorPutOptions.None) { var keyBytes = cur.ToBytes(key); var valueBytes = cur.ToBytes(value); cur.Put(keyBytes, valueBytes, options); }
/// <summary> /// Store by cursor. /// This function stores key/data pairs into the database. The cursor is positioned at the new item, or on failure usually near it. /// Note: Earlier documentation incorrectly said errors would leave the state of the cursor unchanged. /// If the function fails for any reason, the state of the cursor will be unchanged. /// If the function succeeds and an item is inserted into the database, the cursor is always positioned to refer to the newly inserted item. /// </summary> /// <param name="key">The key operated on.</param> /// <param name="value">The data operated on.</param> /// <param name="options"> /// Options for this operation. This parameter must be set to 0 or one of the values described here. /// CursorPutOptions.Current - overwrite the data of the key/data pair to which the cursor refers with the specified data item. The key parameter is ignored. /// CursorPutOptions.NoDuplicateData - enter the new key/data pair only if it does not already appear in the database. This flag may only be specified if the database was opened with MDB_DUPSORT. The function will return MDB_KEYEXIST if the key/data pair already appears in the database. /// CursorPutOptions.NoOverwrite - enter the new key/data pair only if the key does not already appear in the database. The function will return MDB_KEYEXIST if the key already appears in the database, even if the database supports duplicates (MDB_DUPSORT). /// CursorPutOptions.ReserveSpace - reserve space for data of the given size, but don't copy the given data. Instead, return a pointer to the reserved space, which the caller can fill in later. This saves an extra memcpy if the data is being generated later. /// CursorPutOptions.AppendData - append the given key/data pair to the end of the database. No key comparisons are performed. This option allows fast bulk loading when keys are already known to be in the correct order. Loading unsorted keys with this flag will cause data corruption. /// CursorPutOptions.AppendDuplicateData - as above, but for sorted dup data. /// </param> /// <returns>Returns <see cref="MDBResultCode"/></returns> public unsafe MDBResultCode Put(ReadOnlySpan <byte> key, ReadOnlySpan <byte> value, CursorPutOptions options) { fixed(byte *keyPtr = key) fixed(byte *valPtr = value) { var mdbKey = new MDBValue(key.Length, keyPtr); var mdbValue = new MDBValue(value.Length, valPtr); return(mdb_cursor_put(_handle, mdbKey, mdbValue, options)); } }
public void Put <TKey, TValue>(ref TKey key, ref TValue value, CursorPutOptions options) where TKey : struct where TValue : struct { _impl.Put(ref key, ref value, options); }
public static extern int mdb_cursor_put(IntPtr cursor, ref ValueStructure key, ref ValueStructure value, CursorPutOptions flags);
public void Put(ref DirectBuffer key, ref DirectBuffer value, CursorPutOptions options) { _impl.Put(ref key, ref value, options); }
private static extern int mdb_cursor_put(IntPtr cursor, ref ValueStructure key, ValueStructure[] data, CursorPutOptions flags);
public static int mdb_cursor_put(IntPtr cursor, byte[] key, byte[] value, CursorPutOptions flags) { using(var marshal = new MarshalValueStructure(key, value)) return check(LmdbMethods.mdb_cursor_put(cursor, ref marshal.Key, ref marshal.Value, flags)); }
public static int mdb_cursor_put(IntPtr cursor, byte[] key, byte[] value, CursorPutOptions flags) { using (var marshal = new MarshalValueStructure(key, value)) return(check(LmdbMethods.mdb_cursor_put(cursor, ref marshal.Key, ref marshal.Value, flags))); }
public static int mdb_cursor_put(IntPtr cursor, ref ValueStructure key, ValueStructure[] data, CursorPutOptions flags) { return check(LmdbMethods.Overloads.mdb_cursor_put(cursor, ref key, data, flags)); }
/// <summary> /// Store by cursor. /// This function stores key/data pairs into the database. The cursor is positioned at the new item, or on failure usually near it. /// Note: Earlier documentation incorrectly said errors would leave the state of the cursor unchanged. /// If the function fails for any reason, the state of the cursor will be unchanged. /// If the function succeeds and an item is inserted into the database, the cursor is always positioned to refer to the newly inserted item. /// </summary> /// <param name="key">The key operated on.</param> /// <param name="value">The data operated on.</param> /// <param name="options"> /// Options for this operation. This parameter must be set to 0 or one of the values described here. /// CursorPutOptions.Current - overwrite the data of the key/data pair to which the cursor refers with the specified data item. The key parameter is ignored. /// CursorPutOptions.NoDuplicateData - enter the new key/data pair only if it does not already appear in the database. This flag may only be specified if the database was opened with MDB_DUPSORT. The function will return MDB_KEYEXIST if the key/data pair already appears in the database. /// CursorPutOptions.NoOverwrite - enter the new key/data pair only if the key does not already appear in the database. The function will return MDB_KEYEXIST if the key already appears in the database, even if the database supports duplicates (MDB_DUPSORT). /// CursorPutOptions.ReserveSpace - reserve space for data of the given size, but don't copy the given data. Instead, return a pointer to the reserved space, which the caller can fill in later. This saves an extra memcpy if the data is being generated later. /// CursorPutOptions.AppendData - append the given key/data pair to the end of the database. No key comparisons are performed. This option allows fast bulk loading when keys are already known to be in the correct order. Loading unsorted keys with this flag will cause data corruption. /// CursorPutOptions.AppendDuplicateData - as above, but for sorted dup data. /// </param> public void Put(byte[] key, byte[] value, CursorPutOptions options) { Lmdb.mdb_cursor_put(_handle, key, value, options); }
int INativeLibraryFacade.mdb_cursor_put(IntPtr cursor, ref ValueStructure key, ref ValueStructure data, CursorPutOptions flags) { return(FallbackLibraryFacade.mdb_cursor_put(cursor, ref key, ref data, flags)); }