1/*- 2 * See the file LICENSE for redistribution information. 3 * 4 * Copyright (c) 2009 Oracle. All rights reserved. 5 * 6 */ 7using System; 8using System.Collections.Generic; 9using System.Text; 10using BerkeleyDB.Internal; 11 12namespace BerkeleyDB { 13 /// <summary> 14 /// A class for traversing the records of a <see cref="RecnoDatabase"/> 15 /// </summary> 16 public class RecnoCursor : Cursor { 17 internal RecnoCursor(DBC dbc, uint pagesize) 18 : base(dbc, DatabaseType.RECNO, pagesize) { } 19 internal RecnoCursor(DBC dbc, uint pagesize, CachePriority p) 20 : base(dbc, DatabaseType.RECNO, pagesize, p) { } 21 22 /// <summary> 23 /// Create a new cursor that uses the same transaction and locker ID as 24 /// the original cursor. 25 /// </summary> 26 /// <remarks> 27 /// This is useful when an application is using locking and requires two 28 /// or more cursors in the same thread of control. 29 /// </remarks> 30 /// <param name="keepPosition"> 31 /// If true, the newly created cursor is initialized to refer to the 32 /// same position in the database as the original cursor (if any) and 33 /// hold the same locks (if any). If false, or the original cursor does 34 /// not hold a database position and locks, the created cursor is 35 /// uninitialized and will behave like a cursor newly created by 36 /// <see cref="RecnoDatabase.Cursor"/>.</param> 37 /// <returns>A newly created cursor</returns> 38 public new RecnoCursor Duplicate(bool keepPosition) { 39 return new RecnoCursor( 40 dbc.dup(keepPosition ? DbConstants.DB_POSITION : 0), pgsz); 41 } 42 43 /// <summary> 44 /// Insert the data element as a duplicate element of the key to which 45 /// the cursor refers. 46 /// </summary> 47 /// <param name="data">The data element to insert</param> 48 /// <param name="loc"> 49 /// Specify whether to insert the data item immediately before or 50 /// immediately after the cursor's current position. 51 /// </param> 52 public new void Insert(DatabaseEntry data, InsertLocation loc) { 53 base.Insert(data, loc); 54 } 55 } 56}