Delete() public method

Delete items from a database. This function removes key/data pairs from the database. If the database does not support sorted duplicate data items (MDB_DUPSORT) the data parameter is ignored. If the database supports sorted duplicates and the data parameter is NULL, all of the duplicate data items for the key will be deleted. Otherwise, if the data parameter is non-NULL only the matching data item will be deleted. This function will return MDB_NOTFOUND if the specified key/data pair is not in the database.
public Delete ( LightningDatabase db, byte key ) : void
db LightningDatabase A database handle returned by mdb_dbi_open()
key byte The key to delete from the database
return void
        public static void Delete <TKey, TValue>(this LightningTransaction txn, LightningDatabase db, TKey key, TValue value)
        {
            var keyBytes   = db.ToBytes(key);
            var valueBytes = db.ToBytes(value);

            txn.Delete(db, keyBytes, valueBytes);
        }
        public static void Delete <TKey>(this LightningTransaction txn, LightningDatabase db, TKey key)
        {
            var keyBytes = db.ToBytes(key);

            txn.Delete(db, keyBytes);
        }
Esempio n. 3
0
 /// <summary>
 /// Deletes a value from a database for duplicated key values.
 /// </summary>
 /// <typeparam name="TKey">Key type.</typeparam>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="txn">Transaction.</param>
 /// <param name="key">Key.</param>
 /// <param name="value">Value.</param>
 public static void Delete <TKey, TValue>(this LightningTransaction txn, TKey key, TValue value)
 {
     txn.Delete(txn.OpenDatabase(), key, value);
 }
Esempio n. 4
0
 /// <summary>
 /// Delete items from a database.
 /// This function removes key/data pairs from the database.
 /// If the database does not support sorted duplicate data items (MDB_DUPSORT) the data parameter is ignored.
 /// If the database supports sorted duplicates and the data parameter is NULL, all of the duplicate data items for the key will be deleted.
 /// Otherwise, if the data parameter is non-NULL only the matching data item will be deleted.
 /// This function will return MDB_NOTFOUND if the specified key/data pair is not in the database.
 /// </summary>
 /// <param name="txn">A transaction</param>
 /// <param name="key">The key to delete from the database</param>
 /// <param name="value">The data to delete (optional)</param>
 public static void Delete(this LightningTransaction txn, byte[] key, byte[] value = null)
 {
     txn.Delete(txn.OpenDatabase(), key, value);
 }
Esempio n. 5
0
 /// <summary>
 /// Deletes data from database by key.
 /// </summary>
 /// <typeparam name="TKey">Key type.</typeparam>
 /// <param name="txn">Transaction.</param>
 /// <param name="key">Key.</param>
 public static void Delete <TKey>(this LightningTransaction txn, TKey key)
 {
     txn.Delete(txn.OpenDatabase(), key);
 }