/*- * See the file LICENSE for redistribution information. * * Copyright (c) 2009 Oracle. All rights reserved. * */ using System; using System.Collections.Generic; using System.Text; using BerkeleyDB.Internal; namespace BerkeleyDB { /// /// A class for traversing the records of a /// public class HashCursor : Cursor { internal HashCursor(DBC dbc, uint pagesize) : base(dbc, DatabaseType.HASH, pagesize) { } internal HashCursor(DBC dbc, uint pagesize, CachePriority p) : base(dbc, DatabaseType.HASH, pagesize, p) { } /// /// 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 new HashCursor Duplicate(bool keepPosition) { return new HashCursor( dbc.dup(keepPosition ? DbConstants.DB_POSITION : 0), pgsz); } /// /// Insert the data element as a duplicate element of the key to which /// the cursor refers. /// /// The data element to insert /// /// Specify whether to insert the data item immediately before or /// immediately after the cursor's current position. /// public new void Insert(DatabaseEntry data, InsertLocation loc) { base.Insert(data, loc); } /// /// Insert the specified key/data pair into the database, unless a /// key/data pair comparing equally to it already exists in the /// database. /// /// The key/data pair to be inserted /// /// Thrown if a matching key/data pair already exists in the database. /// public new void AddUnique( KeyValuePair pair) { base.AddUnique(pair); } /// /// Insert the specified key/data pair into the database. /// /// The key/data pair to be inserted /// /// If the key already exists in the database and no duplicate sort /// function has been specified, specify whether the inserted data item /// is added as the first or the last of the data items for that key. /// public new void Add(KeyValuePair pair, InsertLocation loc) { base.Add(pair, loc); } } }