InsertRecNo() public static method

public static InsertRecNo ( IntPtr handle, IntPtr txnhandle, byte &keydata, byte recordData, int flags ) : int
handle System.IntPtr
txnhandle System.IntPtr
keydata byte
recordData byte
flags int
return int
Example #1
0
        /// <summary>
        /// Inserts a Database Item into a Record Number Database
        /// </summary>
        /// <returns name="key">The key of the new item</returns>
        /// <remarks>
        /// This method wraps the native ups_db_insert function.
        /// <br />
        /// This function inserts a record as a new Database item.
        /// <br />
        /// </remarks>
        /// <param name="txn">An optional Transaction object</param>
        /// <param name="record">The record of the new item</param>
        /// <param name="flags">Optional flags for this operation.</param>
        /// <exception cref="DatabaseException">
        ///   <list type="bullet">
        ///   <item><see cref="UpsConst.UPS_WRITE_PROTECTED"/>
        ///     if you tried to insert a key in a read-only Database</item>
        ///   </list>
        /// </exception>
        public byte [] InsertRecNo(Transaction txn, byte[] record, int flags)
        {
            int st;

            byte[] key = null;
            lock (this)
            {
                st = NativeMethods.InsertRecNo(handle,
                                               txn != null ? txn.Handle : IntPtr.Zero,
                                               ref key, record, flags);
            }
            if (st != 0)
            {
                throw new DatabaseException(st);
            }
            return(key);
        }