/*- * See the file LICENSE for redistribution information. * * Copyright (c) 2009 Oracle. All rights reserved. * */ using System; using System.Collections; using System.Collections.Generic; using System.Text; using BerkeleyDB.Internal; namespace BerkeleyDB { /// /// A class representing database cursors, which allow for traversal of /// database records. /// public class Cursor : BaseCursor, IDisposable, IEnumerable> { private KeyValuePair cur; private KeyValuePair curMult; private MultipleKeyDatabaseEntry curMultKey; private DatabaseType dbtype; /// /// Protected member, storing the pagesize of the underlying database. /// Used during bulk get (i.e. Move*Multiple). /// protected uint pgsz; /// /// Specifies where to place duplicate data elements of the key to which /// the cursor refers. /// public enum InsertLocation { /// /// The new element appears immediately after the current cursor /// position. /// AFTER, /// /// The new element appears immediately before the current cursor /// position. /// BEFORE, /// /// The new element appears as the first of the data items for the /// given key /// FIRST, /// /// The new element appears as the last of the data items for the /// given key /// LAST }; /// /// The key/data pair at which the cursor currently points. /// /// /// Only one of , and /// will ever be non-empty. /// public KeyValuePair Current { private set { cur = value; curMult = new KeyValuePair(); curMultKey = null; } get { return cur; } } /// /// The key and multiple data items at which the cursor currently /// points. /// /// /// Only one of , and /// will ever be non-empty. /// public KeyValuePair CurrentMultiple { private set { cur = new KeyValuePair(); curMult = value; curMultKey = null; } get { return curMult; } } /// /// The multiple key and data items at which the cursor currently /// points. /// /// /// Only one of , and /// will ever be non-empty. /// public MultipleKeyDatabaseEntry CurrentMultipleKey { private set { cur = new KeyValuePair(); curMult = new KeyValuePair(); curMultKey = value; } get { return curMultKey; } } private CachePriority _priority; /// /// The cache priority for pages referenced by the cursor. /// /// /// The priority of a page biases the replacement algorithm to be more /// or less likely to discard a page when space is needed in the buffer /// pool. The bias is temporary, and pages will eventually be discarded /// if they are not referenced again. The setting is only advisory, and /// does not guarantee pages will be treated in a specific way. /// public CachePriority Priority { get { return _priority; } set { dbc.set_priority(value.priority); _priority = value; } } internal Cursor(DBC dbc, DatabaseType DbType, uint pagesize) : base(dbc) { pgsz = pagesize; dbtype = DbType; } internal Cursor( DBC dbc, DatabaseType DbType, uint pagesize, CachePriority pri) : base(dbc) { Priority = pri; pgsz = pagesize; dbtype = DbType; } #region Internal API /* These protected methods do the heavy lifting. The API methods for * Cursor and its subclasses call into them, which allows the API * methods to expose subsets of the arg lists, because some args are * optional. */ /* Only BTree and Hash can call this version of Add(). */ /// /// Protected method for BTree and Hash to insert with KEYFIRST and /// KEYLAST. /// /// The key/data pair to add /// Where to add, if adding duplicate data protected void Add(KeyValuePair pair, InsertLocation loc) { if (loc == InsertLocation.AFTER) throw new ArgumentException("AFTER may only be specified on Insert()."); if (loc == InsertLocation.BEFORE) throw new ArgumentException("BEFORE may only be specified on Insert()."); Put(pair.Key, pair.Value, (loc == InsertLocation.FIRST) ? DbConstants.DB_KEYFIRST : DbConstants.DB_KEYLAST); } /* Only BTree and Hash can call AddUnique(). */ /// /// Protected method for BTree and Hash to insert with NODUPDATA. /// /// The key/data pair to add protected void AddUnique(KeyValuePair pair) { Put(pair.Key, pair.Value, DbConstants.DB_NODUPDATA); } /* Only BTree, Hash and Recno can call Insert(). */ /// /// Protected method for BTree, Hash and Recno to insert with AFTER and /// BEFORE. /// /// The duplicate data item to add /// /// Whether to add the dup data before or after the current cursor /// position /// protected void Insert(DatabaseEntry data, InsertLocation loc) { if (loc == InsertLocation.FIRST) throw new ArgumentException("FIRST may only be specified on Add()."); if (loc == InsertLocation.LAST) throw new ArgumentException("LAST may only be specified on Add()."); DatabaseEntry key = new DatabaseEntry(); Put(key, data, (loc == InsertLocation.AFTER) ? DbConstants.DB_AFTER : DbConstants.DB_BEFORE); } /* * All flavors of get and put boil down to a call to one of these two * methods, just with different flags. */ /// /// Protected method wrapping DBC->get. /// /// The key to retrieve /// The data to retrieve /// Modify the behavior of get /// The locking configuration to use /// /// True if the cursor was positioned successfully, false otherwise. /// protected bool Get(DatabaseEntry key, DatabaseEntry data, uint flags, LockingInfo info) { flags |= (info == null) ? 0 : info.flags; try { dbc.get(key, data, flags); Current = new KeyValuePair(key, data); return true; } catch (NotFoundException) { Current = new KeyValuePair(); return false; } } /// /// Protected method wrapping DBC->get for bulk get. /// /// The key to retrieve /// The data to retrieve /// Size of the bulk buffer /// Modify the behavior of get /// The locking configuration to use /// /// If true, use DB_MULTIPLE_KEY instead of DB_MULTIPLE /// /// /// True if the cursor was positioned successfully, false otherwise. /// protected bool GetMultiple(DatabaseEntry key, DatabaseEntry data, int BufferSize, uint flags, LockingInfo info, bool isMultKey) { int datasz = 0; bool getboth = false; if (flags == DbConstants.DB_GET_BOTH || flags == DbConstants.DB_GET_BOTH_RANGE) { datasz = (int)data.Data.Length; getboth = true; } flags |= (info == null) ? 0 : info.flags; flags |= (isMultKey) ? DbConstants.DB_MULTIPLE_KEY : DbConstants.DB_MULTIPLE; for (; ; ) { if (getboth) { byte[] udata = new byte[BufferSize]; Array.Copy(data.Data, udata, datasz); data.UserData = udata; data.size = (uint)datasz; } else { data.UserData = new byte[BufferSize]; } try { dbc.get(key, data, flags); if (isMultKey) CurrentMultipleKey = new MultipleKeyDatabaseEntry(dbtype, data); else { MultipleDatabaseEntry mult = new MultipleDatabaseEntry(data); CurrentMultiple = new KeyValuePair( key, mult); } return true; } catch (NotFoundException) { if (isMultKey) CurrentMultipleKey = null; else CurrentMultiple = new KeyValuePair(); return false; } catch (MemoryException) { int sz = (int)data.size; if (sz > BufferSize) BufferSize = sz; else BufferSize *= 2; } } } /// /// Protected method wrapping DBC->put. /// /// The key to store /// The data to store /// Modify the behavior of put protected void Put(DatabaseEntry key, DatabaseEntry data, uint flags) { int ret; ret = dbc.put(key, data, flags); } #endregion Internal API /* * User facing API below. These methods just set the flags as needed * before calling Get or Put. */ /// /// Stores the key/data pair in the database. /// /// /// If the underlying database supports duplicate data items, and if the /// key already exists in the database and a duplicate sort function has /// been specified, the inserted data item is added in its sorted /// location. If the key already exists in the database and no duplicate /// sort function has been specified, the inserted data item is added as /// the first of the data items for that key. /// /// /// The key/data pair to be stored in the database. /// public void Add(KeyValuePair pair) { Put(pair.Key, pair.Value, DbConstants.DB_KEYFIRST); } /// /// Delete the key/data pair to which the cursor refers. /// /// /// /// The cursor position is unchanged after a delete, and subsequent /// calls to cursor functions expecting the cursor to refer to an /// existing key will fail. /// /// /// /// The element has already been deleted. /// public new void Delete() { base.Delete(); Current = new KeyValuePair(); } /// /// Create a new cursor that uses the same transaction and locker ID as /// the original cursor. /// /// /// This is useful when an application is using locking and requires two /// or more cursors in the same thread of control. /// /// /// If true, the newly created cursor is initialized to refer to the /// same position in the database as the original cursor (if any) and /// hold the same locks (if any). If false, or the original cursor does /// not hold a database position and locks, the created cursor is /// uninitialized and will behave like a cursor newly created by /// . /// A newly created cursor public Cursor Duplicate(bool keepPosition) { return new Cursor(dbc.dup( keepPosition ? DbConstants.DB_POSITION : 0), dbtype, pgsz); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } /// /// Returns an enumerator that iterates through the /// . /// /// /// The enumerator will begin at the cursor's current position (or the /// first record if the cursor has not yet been positioned) and iterate /// forwards (i.e. in the direction of ) over the /// remaining records. /// /// An enumerator for the Cursor. public new IEnumerator> GetEnumerator() { while (MoveNext()) yield return Current; } /// /// Set the cursor to refer to the first key/data pair of the database, /// and store that pair in . If the first key has /// duplicate values, the first data item in the set of duplicates is /// stored in . /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveFirst() { return MoveFirst(null); } /// /// Set the cursor to refer to the first key/data pair of the database, /// and store that pair in . If the first key has /// duplicate values, the first data item in the set of duplicates is /// stored in . /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveFirst(LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return Get(key, data, DbConstants.DB_FIRST, info); } /// /// Set the cursor to refer to the first key/data pair of the database, /// and store that key and as many duplicate data items that can fit in /// a buffer the size of one database page in /// . /// /// /// If positioning the cursor fails, will /// contain an empty /// . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveFirstMultiple() { return MoveFirstMultiple((int)pgsz, null); } /// /// Set the cursor to refer to the first key/data pair of the database, /// and store that key and as many duplicate data items that can fit in /// a buffer the size of in /// . /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveFirstMultiple(int BufferSize) { return MoveFirstMultiple(BufferSize, null); } /// /// Set the cursor to refer to the first key/data pair of the database, /// and store that key and as many duplicate data items that can fit in /// a buffer the size of one database page in /// . /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveFirstMultiple(LockingInfo info) { return MoveFirstMultiple((int)pgsz, info); } /// /// Set the cursor to refer to the first key/data pair of the database, /// and store that key and as many duplicate data items that can fit in /// a buffer the size of in /// . /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveFirstMultiple(int BufferSize, LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return GetMultiple( key, data, BufferSize, DbConstants.DB_FIRST, info, false); } /// /// Set the cursor to refer to the first key/data pair of the database, /// and store that pair and as many ensuing key/data pairs that can fit /// in a buffer the size of one database page in /// . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveFirstMultipleKey() { return MoveFirstMultipleKey((int)pgsz, null); } /// /// Set the cursor to refer to the first key/data pair of the database, /// and store that pair and as many ensuing key/data pairs that can fit /// in a buffer the size of in /// . /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveFirstMultipleKey(int BufferSize) { return MoveFirstMultipleKey(BufferSize, null); } /// /// Set the cursor to refer to the first key/data pair of the database, /// and store that pair and as many ensuing key/data pairs that can fit /// in a buffer the size of one database page in /// . /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveFirstMultipleKey(LockingInfo info) { return MoveFirstMultipleKey((int)pgsz, info); } /// /// Set the cursor to refer to the first key/data pair of the database, /// and store that pair and as many ensuing key/data pairs that can fit /// in a buffer the size of in /// . /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveFirstMultipleKey(int BufferSize, LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return GetMultiple( key, data, BufferSize, DbConstants.DB_FIRST, info, true); } /// /// Set the cursor to refer to , and store the /// datum associated with the given key in . In the /// presence of duplicate key values, the first data item in the set of /// duplicates is stored in . /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// The key at which to position the cursor /// /// If true, require the given key to match the key in the database /// exactly. If false, position the cursor at the smallest key greater /// than or equal to the specified key, permitting partial key matches /// and range searches. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool Move(DatabaseEntry key, bool exact) { return Move(key, exact, null); } /// /// Set the cursor to refer to , and store the /// datum associated with the given key in . In the /// presence of duplicate key values, the first data item in the set of /// duplicates is stored in . /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// The key at which to position the cursor /// /// If true, require the given key to match the key in the database /// exactly. If false, position the cursor at the smallest key greater /// than or equal to the specified key, permitting partial key matches /// and range searches. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool Move(DatabaseEntry key, bool exact, LockingInfo info) { DatabaseEntry data = new DatabaseEntry(); return Get(key, data, exact ? DbConstants.DB_SET : DbConstants.DB_SET_RANGE, info); } /// /// Move the cursor to the specified key/data pair of the database. The /// cursor is positioned to a key/data pair if both the key and data /// match the values provided on the key and data parameters. /// /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// /// If this flag is specified on a database configured without sorted /// duplicate support, the value of is ignored. /// /// /// /// The key/data pair at which to position the cursor. /// /// /// If true, require the given key and data to match the key and data /// in the database exactly. If false, position the cursor at the /// smallest data value which is greater than or equal to the value /// provided by (as determined by the /// comparison function). /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool Move( KeyValuePair pair, bool exact) { return Move(pair, exact, null); } /// /// Move the cursor to the specified key/data pair of the database. The /// cursor is positioned to a key/data pair if both the key and data /// match the values provided on the key and data parameters. /// /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// /// If this flag is specified on a database configured without sorted /// duplicate support, the value of is ignored. /// /// /// /// The key/data pair at which to position the cursor. /// /// /// If true, require the given key and data to match the key and data /// in the database exactly. If false, position the cursor at the /// smallest data value which is greater than or equal to the value /// provided by (as determined by the /// comparison function). /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool Move(KeyValuePair pair, bool exact, LockingInfo info) { return Get(pair.Key, pair.Value, exact ? DbConstants.DB_GET_BOTH : DbConstants.DB_GET_BOTH_RANGE, info); } /// /// Set the cursor to refer to the last key/data pair of the database, /// and store that pair in . If the last key has /// duplicate values, the last data item in the set of duplicates is /// stored in . /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveLast() { return MoveLast(null); } /// /// Set the cursor to refer to the last key/data pair of the database, /// and store that pair in . If the last key has /// duplicate values, the last data item in the set of duplicates is /// stored in . /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveLast(LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return Get(key, data, DbConstants.DB_LAST, info); } /// /// Set the cursor to refer to , and store that /// key and as many duplicate data items associated with the given key that /// can fit in a buffer the size of one database page in /// . /// /// The key at which to position the cursor /// /// If true, require the given key to match the key in the database /// exactly. If false, position the cursor at the smallest key greater /// than or equal to the specified key, permitting partial key matches /// and range searches. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultiple(DatabaseEntry key, bool exact) { return MoveMultiple(key, exact, (int)pgsz, null); } /// /// Set the cursor to refer to , and store that /// key and as many duplicate data items associated with the given key that /// can fit in a buffer the size of in /// . /// /// The key at which to position the cursor /// /// If true, require the given key to match the key in the database /// exactly. If false, position the cursor at the smallest key greater /// than or equal to the specified key, permitting partial key matches /// and range searches. /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultiple( DatabaseEntry key, bool exact, int BufferSize) { return MoveMultiple(key, exact, BufferSize, null); } /// /// Set the cursor to refer to , and store that /// key and as many duplicate data items associated with the given key that /// can fit in a buffer the size of one database page in /// . /// /// The key at which to position the cursor /// /// If true, require the given key to match the key in the database /// exactly. If false, position the cursor at the smallest key greater /// than or equal to the specified key, permitting partial key matches /// and range searches. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultiple( DatabaseEntry key, bool exact, LockingInfo info) { return MoveMultiple(key, exact, (int)pgsz, info); } /// /// Set the cursor to refer to , and store that /// key and as many duplicate data items associated with the given key that /// can fit in a buffer the size of in /// . /// /// The key at which to position the cursor /// /// If true, require the given key to match the key in the database /// exactly. If false, position the cursor at the smallest key greater /// than or equal to the specified key, permitting partial key matches /// and range searches. /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultiple( DatabaseEntry key, bool exact, int BufferSize, LockingInfo info) { DatabaseEntry data = new DatabaseEntry(); return GetMultiple(key, data, BufferSize, (exact ? DbConstants.DB_SET : DbConstants.DB_SET_RANGE), info, false); } /// /// Move the cursor to the specified key/data pair of the database, and /// store that key/data pair and as many duplicate data items associated /// with the given key that can fit in a buffer the size of one database /// page in . The cursor is positioned to a /// key/data pair if both the key and data match the values provided on /// the key and data parameters. /// /// /// The key/data pair at which to position the cursor. /// /// /// If true, require the given key and data to match the key and data /// in the database exactly. If false, position the cursor at the /// smallest data value which is greater than or equal to the value /// provided by (as determined by the /// comparison function). /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultiple( KeyValuePair pair, bool exact) { return MoveMultiple(pair, exact, (int)pgsz, null); } /// /// Move the cursor to the specified key/data pair of the database, and /// store that key/data pair and as many duplicate data items associated /// with the given key that can fit in a buffer the size of /// in . The /// cursor is positioned to a key/data pair if both the key and data /// match the values provided on the key and data parameters. /// /// /// The key/data pair at which to position the cursor. /// /// /// If true, require the given key and data to match the key and data /// in the database exactly. If false, position the cursor at the /// smallest data value which is greater than or equal to the value /// provided by (as determined by the /// comparison function). /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultiple( KeyValuePair pair, bool exact, int BufferSize) { return MoveMultiple(pair, exact, BufferSize, null); } /// /// Move the cursor to the specified key/data pair of the database, and /// store that key/data pair and as many duplicate data items associated /// with the given key that can fit in a buffer the size of one database /// page in . The cursor is positioned to a /// key/data pair if both the key and data match the values provided on /// the key and data parameters. /// /// /// The key/data pair at which to position the cursor. /// /// /// If true, require the given key and data to match the key and data /// in the database exactly. If false, position the cursor at the /// smallest data value which is greater than or equal to the value /// provided by (as determined by the /// comparison function). /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultiple( KeyValuePair pair, bool exact, LockingInfo info) { return MoveMultiple(pair, exact, (int)pgsz, info); } /// /// Move the cursor to the specified key/data pair of the database, and /// store that key/data pair and as many duplicate data items associated /// with the given key that can fit in a buffer the size of /// in . The /// cursor is positioned to a key/data pair if both the key and data /// match the values provided on the key and data parameters. /// /// /// The key/data pair at which to position the cursor. /// /// /// If true, require the given key and data to match the key and data /// in the database exactly. If false, position the cursor at the /// smallest data value which is greater than or equal to the value /// provided by (as determined by the /// comparison function). /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultiple( KeyValuePair pair, bool exact, int BufferSize, LockingInfo info) { return GetMultiple(pair.Key, pair.Value, BufferSize, (exact ? DbConstants.DB_GET_BOTH : DbConstants.DB_GET_BOTH_RANGE), info, false); } /// /// Set the cursor to refer to , and store that /// key and as many ensuing key/data pairs that can fit in a buffer the /// size of one database page in . /// /// The key at which to position the cursor /// /// If true, require the given key to match the key in the database /// exactly. If false, position the cursor at the smallest key greater /// than or equal to the specified key, permitting partial key matches /// and range searches. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultipleKey(DatabaseEntry key, bool exact) { return MoveMultipleKey(key, exact, (int)pgsz, null); } /// /// Set the cursor to refer to , and store that /// key and as many ensuing key/data pairs that can fit in a buffer the /// size of in /// . /// /// The key at which to position the cursor /// /// If true, require the given key to match the key in the database /// exactly. If false, position the cursor at the smallest key greater /// than or equal to the specified key, permitting partial key matches /// and range searches. /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultipleKey( DatabaseEntry key, bool exact, int BufferSize) { return MoveMultipleKey(key, exact, BufferSize, null); } /// /// Set the cursor to refer to , and store that /// key and as many ensuing key/data pairs that can fit in a buffer the /// size of one database page in . /// /// The key at which to position the cursor /// /// If true, require the given key to match the key in the database /// exactly. If false, position the cursor at the smallest key greater /// than or equal to the specified key, permitting partial key matches /// and range searches. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultipleKey( DatabaseEntry key, bool exact, LockingInfo info) { return MoveMultipleKey(key, exact, (int)pgsz, info); } /// /// Set the cursor to refer to , and store that /// key and as many ensuing key/data pairs that can fit in a buffer the /// size of in /// . /// /// The key at which to position the cursor /// /// If true, require the given key to match the key in the database /// exactly. If false, position the cursor at the smallest key greater /// than or equal to the specified key, permitting partial key matches /// and range searches. /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultipleKey( DatabaseEntry key, bool exact, int BufferSize, LockingInfo info) { DatabaseEntry data = new DatabaseEntry(); return GetMultiple(key, data, BufferSize, (exact ? DbConstants.DB_SET : DbConstants.DB_SET_RANGE), info, true); } /// /// Move the cursor to the specified key/data pair of the database, and /// store that key/data pair and as many ensuing key/data pairs that can /// fit in a buffer the size of one database page in /// . The cursor is positioned to a /// key/data pair if both the key and data match the values provided on /// the key and data parameters. /// /// /// The key/data pair at which to position the cursor. /// /// /// If true, require the given key and data to match the key and data /// in the database exactly. If false, position the cursor at the /// smallest data value which is greater than or equal to the value /// provided by (as determined by the /// comparison function). /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultipleKey( KeyValuePair pair, bool exact) { return MoveMultipleKey(pair, exact, (int)pgsz, null); } /// /// Move the cursor to the specified key/data pair of the database, and /// store that key/data pair and as many ensuing key/data pairs that can /// fit in a buffer the size of in /// . The cursor is positioned to a /// key/data pair if both the key and data match the values provided on /// the key and data parameters. /// /// /// The key/data pair at which to position the cursor. /// /// /// If true, require the given key and data to match the key and data /// in the database exactly. If false, position the cursor at the /// smallest data value which is greater than or equal to the value /// provided by (as determined by the /// comparison function). /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultipleKey( KeyValuePair pair, bool exact, int BufferSize) { return MoveMultipleKey(pair, exact, BufferSize, null); } /// /// Move the cursor to the specified key/data pair of the database, and /// store that key/data pair and as many ensuing key/data pairs that can /// fit in a buffer the size of one database page in /// . The cursor is positioned to a /// key/data pair if both the key and data match the values provided on /// the key and data parameters. /// /// /// The key/data pair at which to position the cursor. /// /// /// If true, require the given key and data to match the key and data /// in the database exactly. If false, position the cursor at the /// smallest data value which is greater than or equal to the value /// provided by (as determined by the /// comparison function). /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultipleKey( KeyValuePair pair, bool exact, LockingInfo info) { return MoveMultipleKey(pair, exact, (int)pgsz, info); } /// /// Move the cursor to the specified key/data pair of the database, and /// store that key/data pair and as many ensuing key/data pairs that can /// fit in a buffer the size of in /// . The cursor is positioned to a /// key/data pair if both the key and data match the values provided on /// the key and data parameters. /// /// /// The key/data pair at which to position the cursor. /// /// /// If true, require the given key and data to match the key and data /// in the database exactly. If false, position the cursor at the /// smallest data value which is greater than or equal to the value /// provided by (as determined by the /// comparison function). /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveMultipleKey( KeyValuePair pair, bool exact, int BufferSize, LockingInfo info) { return GetMultiple(pair.Key, pair.Value, BufferSize, (exact ? DbConstants.DB_GET_BOTH : DbConstants.DB_GET_BOTH_RANGE), info, true); } /// /// If the cursor is not yet initialized, MoveNext is identical to /// . Otherwise, move the cursor to the next /// key/data pair of the database, and store that pair in /// . In the presence of duplicate key values, the /// value of Current.Key may not change. /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNext() { return MoveNext(null); } /// /// If the cursor is not yet initialized, MoveNext is identical to /// . Otherwise, move the cursor to /// the next key/data pair of the database, and store that pair in /// . In the presence of duplicate key values, the /// value of Current.Key may not change. /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNext(LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return Get(key, data, DbConstants.DB_NEXT, info); } /// /// If the cursor is not yet initialized, MoveNextMultiple is identical /// to . Otherwise, move the cursor to /// the next key/data pair of the database, and store that pair and as /// many duplicate data items that can fit in a buffer the size of one /// database page in . In the presence of /// duplicate key values, the value of /// CurrentMultiple.Key may not /// change. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextMultiple() { return MoveNextMultiple((int)pgsz, null); } /// /// If the cursor is not yet initialized, MoveNextMultiple is identical /// to . Otherwise, move the cursor /// to the next key/data pair of the database, and store that pair and /// as many duplicate data items that can fit in a buffer the size of /// in . In /// the presence of duplicate key values, the value of /// CurrentMultiple.Key may not /// change. /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextMultiple(int BufferSize) { return MoveNextMultiple(BufferSize, null); } /// /// If the cursor is not yet initialized, MoveNextMultiple is identical /// to . Otherwise, move the /// cursor to the next key/data pair of the database, and store that /// pair and as many duplicate data items that can fit in a buffer the /// size of one database page in . In the /// presence of duplicate key values, the value of /// CurrentMultiple.Key may not /// change. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextMultiple(LockingInfo info) { return MoveNextMultiple((int)pgsz, null); } /// /// If the cursor is not yet initialized, MoveNextMultiple is identical /// to . Otherwise, /// move the cursor to the next key/data pair of the database, and store /// that pair and as many duplicate data items that can fit in a buffer /// the size of in /// . In the presence of duplicate key /// values, the value of /// CurrentMultiple.Key may not /// change. /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextMultiple(int BufferSize, LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return GetMultiple( key, data, BufferSize, DbConstants.DB_NEXT, info, false); } /// /// If the cursor is not yet initialized, MoveNextMultipleKey is /// identical to . Otherwise, move /// the cursor to the next key/data pair of the database, and store that /// pair and as many ensuing key/data pairs that can fit in a buffer the /// size of one database page in . In /// the presence of duplicate key values, the keys of /// may not change. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextMultipleKey() { return MoveNextMultipleKey((int)pgsz, null); } /// /// If the cursor is not yet initialized, MoveNextMultipleKey is /// identical to . Otherwise, /// move the cursor to the next key/data pair of the database, and store /// that pair and as many ensuing key/data pairs that can fit in a /// buffer the size of in /// . In the presence of duplicate key /// values, the keys of may not change. /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextMultipleKey(int BufferSize) { return MoveNextMultipleKey(BufferSize, null); } /// /// If the cursor is not yet initialized, MoveNextMultipleKey is /// identical to . /// Otherwise, move the cursor to the next key/data pair of the /// database, and store that pair and as many ensuing key/data pairs /// that can fit in a buffer the size of one database page in /// . In the presence of duplicate key /// values, the keys of may not change. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextMultipleKey(LockingInfo info) { return MoveNextMultipleKey((int)pgsz, null); } /// /// If the cursor is not yet initialized, MoveNextMultipleKey is /// identical to . /// Otherwise, move the cursor to the next key/data pair of the /// database, and store that pair and as many ensuing key/data pairs /// that can fit in a buffer the size of /// in . In the presence of duplicate /// key values, the keys of may not /// change. /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextMultipleKey(int BufferSize, LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return GetMultiple( key, data, BufferSize, DbConstants.DB_NEXT, info, true); } /// /// If the next key/data pair of the database is a duplicate data record /// for the current key/data pair, move the cursor to the next key/data /// pair in the database, and store that pair in . /// MoveNextDuplicate will return false if the next key/data pair of the /// database is not a duplicate data record for the current key/data /// pair. /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextDuplicate() { return MoveNextDuplicate(null); } /// /// If the next key/data pair of the database is a duplicate data record /// for the current key/data pair, move the cursor to the next key/data /// pair in the database, and store that pair in . /// MoveNextDuplicate will return false if the next key/data pair of the /// database is not a duplicate data record for the current key/data /// pair. /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextDuplicate(LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return Get(key, data, DbConstants.DB_NEXT_DUP, info); } /// /// If the next key/data pair of the database is a duplicate data record /// for the current key/data pair, move the cursor to the next key/data /// pair in the database, and store that pair and as many duplicate data /// items that can fit in a buffer the size of one database page in /// . MoveNextDuplicateMultiple will return /// false if the next key/data pair of the database is not a duplicate /// data record for the current key/data pair. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextDuplicateMultiple() { return MoveNextDuplicateMultiple((int)pgsz, null); } /// /// If the next key/data pair of the database is a duplicate data record /// for the current key/data pair, then move cursor to the next key/data /// pair in the database, and store that pair and as many duplicate data /// items that can fit in a buffer the size of /// in . /// MoveNextDuplicateMultiple will return false if the next key/data /// pair of the database is not a duplicate data record for the current /// key/data pair. /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextDuplicateMultiple(int BufferSize) { return MoveNextDuplicateMultiple(BufferSize, null); } /// /// If the next key/data pair of the database is a duplicate data record /// for the current key/data pair, move the cursor to the next key/data /// pair in the database, and store that pair and as many duplicate data /// items that can fit in a buffer the size of one database page in /// . MoveNextDuplicateMultiple will return /// false if the next key/data pair of the database is not a duplicate /// data record for the current key/data pair. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextDuplicateMultiple(LockingInfo info) { return MoveNextDuplicateMultiple((int)pgsz, info); } /// /// If the next key/data pair of the database is a duplicate data record /// for the current key/data pair, move the cursor to the next key/data /// pair in the database, and store that pair and as many duplicate data /// items that can fit in a buffer the size of /// in . /// MoveNextDuplicateMultiple will return false if the next key/data /// pair of the database is not a duplicate data record for the current /// key/data pair. /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextDuplicateMultiple( int BufferSize, LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return GetMultiple( key, data, BufferSize, DbConstants.DB_NEXT_DUP, info, false); } /// /// If the next key/data pair of the database is a duplicate data record /// for the current key/data pair, move the cursor to the next key/data /// pair in the database, and store that pair and as many duplicate data /// items that can fit in a buffer the size of one database page in /// . MoveNextDuplicateMultipleKey will /// return false if the next key/data pair of the database is not a /// duplicate data record for the current key/data pair. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextDuplicateMultipleKey() { return MoveNextDuplicateMultipleKey((int)pgsz, null); } /// /// If the next key/data pair of the database is a duplicate data record /// for the current key/data pair, move the cursor to the next key/data /// pair in the database, and store that pair and as many duplicate data /// items that can fit in a buffer the size of /// in . /// MoveNextDuplicateMultipleKey will return false if the next key/data /// pair of the database is not a duplicate data record for the current /// key/data pair. /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextDuplicateMultipleKey(int BufferSize) { return MoveNextDuplicateMultipleKey(BufferSize, null); } /// /// If the next key/data pair of the database is a duplicate data record /// for the current key/data pair, move the cursor to the next key/data /// pair in the database, and store that pair and as many duplicate data /// items that can fit in a buffer the size of one database page in /// . MoveNextDuplicateMultipleKey will /// return false if the next key/data pair of the database is not a /// duplicate data record for the current key/data pair. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextDuplicateMultipleKey(LockingInfo info) { return MoveNextDuplicateMultipleKey((int)pgsz, info); } /// /// If the next key/data pair of the database is a duplicate data record /// for the current key/data pair, move the cursor to the next key/data /// pair in the database, and store that pair and as many duplicate data /// items that can fit in a buffer the size of /// in . /// MoveNextDuplicateMultipleKey will return false if the next key/data /// pair of the database is not a duplicate data record for the current /// key/data pair. /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextDuplicateMultipleKey( int BufferSize, LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return GetMultiple( key, data, BufferSize, DbConstants.DB_NEXT_DUP, info, true); } /// /// If the cursor is not yet initialized, MoveNextUnique is identical to /// . Otherwise, move the cursor to the next /// non-duplicate key in the database, and store that key and associated /// datum in . MoveNextUnique will return false if /// no non-duplicate key/data pairs exist after the cursor position in /// the database. /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextUnique() { return MoveNextUnique(null); } /// /// If the cursor is not yet initialized, MoveNextUnique is identical to /// . Otherwise, move the cursor to /// the next non-duplicate key in the database, and store that key and /// associated datum in . MoveNextUnique will /// return false if no non-duplicate key/data pairs exist after the /// cursor position in the database. /// /// /// /// If the database is a Queue or Recno database, MoveNextUnique will /// ignore any keys that exist but were never explicitly created by the /// application, or those that were created and later deleted. /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextUnique(LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return Get(key, data, DbConstants.DB_NEXT_NODUP, info); } /// /// If the cursor is not yet initialized, MoveNextUniqueMultiple is /// identical to . Otherwise, move the /// cursor to the next non-duplicate key in the database, and store that /// key and associated datum and as many duplicate data items that can /// fit in a buffer the size of one database page in /// . MoveNextUniqueMultiple will return /// false if no non-duplicate key/data pairs exist after the cursor /// position in the database. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextUniqueMultiple() { return MoveNextUniqueMultiple((int)pgsz, null); } /// /// If the cursor is not yet initialized, MoveNextUniqueMultiple is /// identical to . Otherwise, move /// the cursor to the next non-duplicate key in the database, and store /// that key and associated datum and as many duplicate data items that /// can fit in a buffer the size of in /// . MoveNextUniqueMultiple will return /// false if no non-duplicate key/data pairs exist after the cursor /// position in the database. /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextUniqueMultiple(int BufferSize) { return MoveNextUniqueMultiple(BufferSize, null); } /// /// If the cursor is not yet initialized, MoveNextUniqueMultiple is /// identical to . /// Otherwise, move the cursor to the next non-duplicate key in the /// database, and store that key and associated datum and as many /// duplicate data items that can fit in a buffer the size of one /// database page in . /// MoveNextUniqueMultiple will return false if no non-duplicate /// key/data pairs exist after the cursor position in the database. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextUniqueMultiple(LockingInfo info) { return MoveNextUniqueMultiple((int)pgsz, info); } /// /// If the cursor is not yet initialized, MoveNextUniqueMultiple is /// identical to . /// Otherwise, move the cursor to the next non-duplicate key in the /// database, and store that key and associated datum and as many /// duplicate data items that can fit in a buffer the size of /// in . /// MoveNextUniqueMultiple will return false if no non-duplicate /// key/data pairs exist after the cursor position in the database. /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextUniqueMultiple(int BufferSize, LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return GetMultiple( key, data, BufferSize, DbConstants.DB_NEXT_NODUP, info, false); } /// /// If the cursor is not yet initialized, MoveNextUniqueMultipleKey is /// identical to . Otherwise, move /// the cursor to the next non-duplicate key in the database, and store /// that key and associated datum and as many ensuing key/data pairs /// that can fit in a buffer the size of one database page in /// . MoveNextUniqueMultipleKey will /// return false if no non-duplicate key/data pairs exist after the /// cursor position in the database. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextUniqueMultipleKey() { return MoveNextUniqueMultipleKey((int)pgsz, null); } /// /// If the cursor is not yet initialized, MoveNextUniqueMultipleKey is /// identical to . Otherwise, /// move the cursor to the next non-duplicate key in the database, and /// store that key and associated datum and as many ensuing key/data /// pairs that can fit in a buffer the size of /// in . /// MoveNextUniqueMultipleKey will return false if no non-duplicate /// key/data pairs exist after the cursor position in the database. /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextUniqueMultipleKey(int BufferSize) { return MoveNextUniqueMultipleKey(BufferSize, null); } /// /// If the cursor is not yet initialized, MoveNextUniqueMultipleKey is /// identical to . /// Otherwise, move the cursor to the next non-duplicate key in the /// database, and store that key and associated datum and as many /// ensuing key/data pairs that can fit in a buffer the size of one /// database page in . /// MoveNextUniqueMultipleKey will return false if no non-duplicate /// key/data pairs exist after the cursor position in the database. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextUniqueMultipleKey(LockingInfo info) { return MoveNextUniqueMultipleKey((int)pgsz, info); } /// /// If the cursor is not yet initialized, MoveNextUniqueMultipleKey is /// identical to . /// Otherwise, move the cursor to the next non-duplicate key in the /// database, and store that key and associated datum and as many /// ensuing key/data pairs that can fit in a buffer the size of /// in . /// MoveNextUniqueMultipleKey will return false if no non-duplicate /// key/data pairs exist after the cursor position in the database. /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MoveNextUniqueMultipleKey( int BufferSize, LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return GetMultiple( key, data, BufferSize, DbConstants.DB_NEXT_NODUP, info, true); } /// /// If the cursor is not yet initialized, MovePrev is identical to /// . Otherwise, move the cursor to the previous /// key/data pair of the database, and store that pair in /// . In the presence of duplicate key values, the /// value of Current.Key may not change. /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MovePrev() { return MovePrev(null); } /// /// If the cursor is not yet initialized, MovePrev is identical to /// . Otherwise, move the cursor to /// the previous key/data pair of the database, and store that pair in /// . In the presence of duplicate key values, the /// value of Current.Key may not change. /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MovePrev(LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return Get(key, data, DbConstants.DB_PREV, info); } /// /// If the previous key/data pair of the database is a duplicate data /// record for the current key/data pair, the cursor is moved to the /// previous key/data pair of the database, and that pair is stored in /// . MovePrevDuplicate will return false if the /// previous key/data pair of the database is not a duplicate data /// record for the current key/data pair. /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MovePrevDuplicate() { return MovePrevDuplicate(null); } /// /// If the previous key/data pair of the database is a duplicate data /// record for the current key/data pair, the cursor is moved to the /// previous key/data pair of the database, and that pair is stored in /// . MovePrevDuplicate will return false if the /// previous key/data pair of the database is not a duplicate data /// record for the current key/data pair. /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MovePrevDuplicate(LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return Get(key, data, DbConstants.DB_PREV_DUP, info); } /// /// If the cursor is not yet initialized, MovePrevUnique is identical to /// . Otherwise, move the cursor to the previous /// non-duplicate key in the database, and store that key and associated /// datum in . MovePrevUnique will return false if /// no non-duplicate key/data pairs exist after the cursor position in /// the database. /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MovePrevUnique() { return MovePrevUnique(null); } /// /// If the cursor is not yet initialized, MovePrevUnique is identical to /// . Otherwise, move the cursor to /// the previous non-duplicate key in the database, and store that key /// and associated datum in . MovePrevUnique will /// return false if no non-duplicate key/data pairs exist after the /// cursor position in the database. /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool MovePrevUnique(LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return Get(key, data, DbConstants.DB_PREV_NODUP, info); } /// /// Overwrite the data of the key/data pair to which the cursor refers /// with the specified data item. /// /// public void Overwrite(DatabaseEntry data) { DatabaseEntry key = new DatabaseEntry(); Put(key, data, DbConstants.DB_CURRENT); } /// /// Store the key/data pair to which the cursor refers in /// . /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool Refresh() { return Refresh(null); } /// /// Store the key/data pair to which the cursor refers in /// . /// /// /// If positioning the cursor fails, will contain /// an empty . /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool Refresh(LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return Get(key, data, DbConstants.DB_CURRENT, info); } /// /// Store the key/data pair to which the cursor refers and as many /// duplicate data items that can fit in a buffer the size of one /// database page in . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool RefreshMultiple() { return RefreshMultiple((int)pgsz, null); } /// /// Store the key/data pair to which the cursor refers and as many /// duplicate data items that can fit in a buffer the size of /// in . /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool RefreshMultiple(int BufferSize) { return RefreshMultiple(BufferSize, null); } /// /// Store the key/data pair to which the cursor refers and as many /// duplicate data items that can fit in a buffer the size of one /// database page in . /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool RefreshMultiple(LockingInfo info) { return RefreshMultiple((int)pgsz, info); } /// /// Store the key/data pair to which the cursor refers and as many /// duplicate data items that can fit in a buffer the size of /// in . /// /// /// The size of a buffer to fill with duplicate data items. Must be at /// least the page size of the underlying database and be a multiple of /// 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool RefreshMultiple(int BufferSize, LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return GetMultiple( key, data, BufferSize, DbConstants.DB_CURRENT, info, false); } /// /// Store the key/data pair to which the cursor refers and as many /// ensuing key/data pairs that can fit in a buffer the size of one /// database page in . /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool RefreshMultipleKey() { return RefreshMultipleKey((int)pgsz, null); } /// /// Store the key/data pair to which the cursor refers and as many /// ensuing key/data pairs that can fit in a buffer the size of /// in . /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// /// True if the cursor was positioned successfully, false otherwise. /// public bool RefreshMultipleKey(int BufferSize) { return RefreshMultipleKey(BufferSize, null); } /// /// Store the key/data pair to which the cursor refers and as many /// ensuing key/data pairs that can fit in a buffer the size of one /// database page in . /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool RefreshMultipleKey(LockingInfo info) { return RefreshMultipleKey((int)pgsz, info); } /// /// Store the key/data pair to which the cursor refers and as many /// ensuing key/data pairs that can fit in a buffer the size of /// in . /// /// /// The size of a buffer to fill with key/data pairs. Must be at least /// the page size of the underlying database and be a multiple of 1024. /// /// The locking behavior to use. /// /// True if the cursor was positioned successfully, false otherwise. /// public bool RefreshMultipleKey(int BufferSize, LockingInfo info) { DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); return GetMultiple( key, data, BufferSize, DbConstants.DB_CURRENT, info, true); } } }