Find() public static méthode

public static Find ( IntPtr handle, IntPtr txnhandle, byte &keydata, byte &recdata, int flags ) : int
handle System.IntPtr
txnhandle System.IntPtr
keydata byte
recdata byte
flags int
Résultat int
Exemple #1
0
 /// <summary>
 /// Searches an item in the Database, returns the record
 /// </summary>
 /// <remarks>
 /// This method wraps the native ups_db_find function.<br />
 /// <br />
 /// This function searches the Database for a key. If the key
 /// is found, the method will return the record of this item.
 /// <br />
 /// Database.Find can not search for duplicate keys. If the
 /// key has multiple duplicates, only the first duplicate is returned.
 /// </remarks>
 /// <param name="txn">The optional Transaction</param>
 /// <param name="key">The key of the item</param>
 /// <param name="flags">The flags of the operation</param>
 /// <returns>The record of the item</returns>
 /// <exception cref="DatabaseException">
 ///   <list type="bullet">
 ///   <item><see cref="UpsConst.UPS_KEY_NOT_FOUND"/>
 ///     if the item was not found</item>
 ///   </list>
 /// </exception>
 public byte[] Find(Transaction txn, ref byte[] key, int flags)
 {
     byte[] record = null;
     lock (this) {
         int st = NativeMethods.Find(handle,
                                     txn != null ? txn.Handle : IntPtr.Zero,
                                     ref key, ref record, flags);
         if (st != 0)
         {
             throw new DatabaseException(st);
         }
     }
     return(record);
 }