Пример #1
0
 public double EstimatedQueryCost(Transaction transaction)
 {
     var endOfKeyRange = string.Concat(Key, new string(char.MaxValue, 1));
     return (managedIndex.Index.KeyRange(new DatabaseEntry(managedIndex.KeyAsByteArray(endOfKeyRange)), transaction).Less -
             managedIndex.Index.KeyRange(new DatabaseEntry(managedIndex.KeyAsByteArray(Key)), transaction).Less) *
            managedIndex.Index.FastStats().nPages / pageSizeBufferMultipler * (double)QueryCostScale;
 }
Пример #2
0
        public IEnumerable<InternalId> Execute(Transaction transaction)
        {
            var cursor = managedIndex.Index.Cursor(new CursorConfig(), transaction);
            try
            {
                var comparer = managedIndex.Comparer;
                var keyAsBytes = managedIndex.KeyAsByteArray(Key);
                var bufferSize = (int)managedIndex.Index.Pagesize * pageSizeBufferMultipler;

                if(cursor.MoveMultipleKey(new DatabaseEntry(keyAsBytes), false, bufferSize))
                {
                    do
                    {
                        //Each char is 2 bytes. Only take the start of the key data to the length of the query key.
                        foreach(var internalId in
                            cursor.CurrentMultipleKey
                                .Select(_ => new {key = _.Key.Data.Take(Key.Length * 2).ToArray(), value = _.Value.Data.AsInternalId()})
                                .TakeWhile(pair => comparer.Compare(managedIndex.ByteArrayAsKey(pair.key), Key) == 0)
                                .Select(_ => _.value))
                        {
                            yield return internalId;
                        }
                    }
                    while(cursor.MoveNextMultipleKey(bufferSize) &&
                          comparer.Compare(managedIndex.ByteArrayAsKey(cursor.CurrentMultipleKey.First().Key.Data), Key) == 0);
                }
            }
            finally
            {
                cursor.Close();
            }
        }
Пример #3
0
        public static void SetUpEnvWithTxnAndLocking(string envHome,
		    out DatabaseEnvironment env, out Transaction txn,
		    uint maxLock, uint maxLocker, uint maxObject, uint partition)
        {
            // Configure env and locking subsystem.
            LockingConfig lkConfig = new LockingConfig();

            /*
             * If the maximum number of locks/lockers/objects
             * is given, then the LockingConfig is set. Unless,
             * it is not set to any value.
             */
            if (maxLock != 0)
                lkConfig.MaxLocks = maxLock;
            if (maxLocker != 0)
                lkConfig.MaxLockers = maxLocker;
            if (maxObject != 0)
                lkConfig.MaxObjects = maxObject;
            if (partition != 0)
                lkConfig.Partitions = partition;

            DatabaseEnvironmentConfig envConfig =
                new DatabaseEnvironmentConfig();
            envConfig.Create = true;
            envConfig.UseTxns = true;
            envConfig.UseMPool = true;
            envConfig.LockSystemCfg = lkConfig;
            envConfig.UseLocking = true;
            envConfig.NoLocking = false;
            env = DatabaseEnvironment.Open(envHome, envConfig);
            txn = env.BeginTransaction();
        }
Пример #4
0
 public IEnumerable<InternalId> Execute(Transaction transaction)
 {
     var cursor = managedIndex.ReverseIndex.Cursor();
     while(cursor.MoveNextUnique())
     {
         yield return cursor.Current.Key.Data.AsInternalId();
     }
 }
Пример #5
0
        public IEnumerable<InternalId> ExecuteInsideIntersect(Transaction transaction, IEnumerable<InternalId> joinConstraint)
        {
            if(joinConstraint.Count() > EstimatedQueryCost(transaction))
                return Execute(transaction);

            var cursor = managedIndex.ReverseIndex.Cursor();

            return
                joinConstraint
                    .Where(joinMatched => cursor.Move(new DatabaseEntry(joinMatched.AsByteArray()), true));
        }
Пример #6
0
 /// <summary>
 /// Instantiate a new Sequence object.
 /// </summary>
 /// <remarks>
 /// If <paramref name="txn"/> is null and the operation occurs in a
 /// transactional database, the operation will be implicitly transaction
 /// protected.
 /// </remarks>
 /// <param name="cfg">Configuration parameters for the Sequence</param>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 public Sequence(SequenceConfig cfg, Transaction txn) {
     seq = new DB_SEQUENCE(cfg.BackingDatabase.db, 0);
     if (cfg.initialValIsSet)
         seq.initial_value(cfg.InitialValue);
     seq.set_flags(cfg.flags);
     if (cfg.rangeIsSet)
         seq.set_range(cfg.Min, cfg.Max);
     if (cfg.cacheSzIsSet)
         seq.set_cachesize(cfg.CacheSize);
     seq.open(Transaction.getDB_TXN(txn),
         cfg.key, cfg.openFlags);
     isOpen = true;
 }
Пример #7
0
        public void OpenBtreeDBInEnv(string dbName,
		    DatabaseEnvironment env, out BTreeDatabase db,
		    bool create, Transaction txn)
        {
            BTreeDatabaseConfig btreeDBConfig =
                new BTreeDatabaseConfig();
            btreeDBConfig.Env = env;
            if (create == true)
                btreeDBConfig.Creation = CreatePolicy.IF_NEEDED;
            else
                btreeDBConfig.Creation = CreatePolicy.NEVER;
            if (txn == null)
                db = BTreeDatabase.Open(dbName,
                    btreeDBConfig);
            else
                db = BTreeDatabase.Open(dbName,
                    btreeDBConfig, txn);
        }
Пример #8
0
 /// <summary>
 /// Instantiate a new SecondaryDatabase object, open the database
 /// represented by <paramref name="Filename"/> and associate the
 /// database with the <see cref="SecondaryDatabaseConfig.Primary">
 /// primary index</see>. The file specified by
 /// <paramref name="Filename"/> must exist.
 /// </summary>
 /// <remarks>
 /// <para>
 /// If <see cref="DatabaseConfig.AutoCommit"/> is set, the operation
 /// is implicitly transaction protected. Transactionally
 /// protected operations on a database object requires the object itself
 /// be transactionally protected during its open.
 /// </para>
 /// </remarks>
 /// <param name="Filename">
 /// The name of an underlying file used to back the
 /// database.
 /// </param>
 /// <param name="cfg">The database's configuration</param>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <returns>A new, open database object</returns>
 public static SecondaryDatabase Open(string Filename,
                                      SecondaryDatabaseConfig cfg, Transaction txn)
 {
     return(Open(Filename, null, cfg, txn));
 }
Пример #9
0
 /// <summary>
 /// Instantiate a new RecnoDatabase object and open the database
 /// represented by <paramref name="Filename"/>.
 /// </summary>
 /// <remarks>
 /// <para>
 /// If <paramref name="Filename"/> is null, the database is strictly
 /// temporary and cannot be opened by any other thread of control, thus
 /// the database can only be accessed by sharing the single database
 /// object that created it, in circumstances where doing so is safe.
 /// </para>
 /// <para>
 /// If <paramref name="txn"/> is null, but
 /// <see cref="DatabaseConfig.AutoCommit"/> is set, the operation will
 /// be implicitly transaction protected. Note that transactionally
 /// protected operations on a datbase object requires the object itself
 /// be transactionally protected during its open. Also note that the
 /// transaction must be committed before the object is closed.
 /// </para>
 /// </remarks>
 /// <param name="Filename">
 /// The name of an underlying file that will be used to back the
 /// database. In-memory databases never intended to be preserved on disk
 /// may be created by setting this parameter to null.
 /// </param>
 /// <param name="cfg">The database's configuration</param>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <returns>A new, open database object</returns>
 public static RecnoDatabase Open(
     string Filename, RecnoDatabaseConfig cfg, Transaction txn)
 {
     return(Open(Filename, null, cfg, txn));
 }
Пример #10
0
 /// <summary>
 /// Store the key/data pair in the database, replacing any previously
 /// existing key if duplicates are disallowed, or adding a duplicate
 /// data item if duplicates are allowed.
 /// </summary>
 /// <remarks>
 /// <para>
 /// When partial put to a duplicate database, a
 /// <see cref="DatabaseException"/> is thrown.
 /// </para>
 /// </remarks>
 /// <param name="key">The key to store in the database</param>
 /// <param name="data">The data item to store in the database</param>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <exception cref="DatabaseException">
 /// Partial put to a duplicate database, or <see cref="QueueDatabase"/>
 /// or <see cref="RecnoDatabase"/> with fixed-length records.
 /// </exception>
 public void Put(
     DatabaseEntry key, DatabaseEntry data, Transaction txn)
 {
     Put(key, data, txn, 0);
 }
Пример #11
0
 /// <summary>
 /// Store the key/data pair in the database, only if the key does not
 /// already appear in the database.
 /// </summary>
 /// <remarks>
 /// This enforcement of uniqueness of keys applies only to the primary
 /// key, the behavior of insertions into secondary databases is not
 /// affected. In particular, the insertion of a record that would result
 /// in the creation of a duplicate key in a secondary database that
 /// allows duplicates would not be prevented by the use of this flag.
 /// </remarks>
 /// <param name="key">The key to store in the database</param>
 /// <param name="data">The data item to store in the database</param>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 public void PutNoOverwrite(
     DatabaseEntry key, DatabaseEntry data, Transaction txn)
 {
     Put(key, data, txn, DbConstants.DB_NOOVERWRITE);
 }
Пример #12
0
 /// <summary>
 /// Return the database statistical information for this database.
 /// </summary>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <returns>Database statistical information.</returns>
 public HeapStats Stats(Transaction txn)
 {
     return Stats(txn, false, Isolation.DEGREE_THREE);
 }
Пример #13
0
 private HeapStats Stats(Transaction txn, bool fast, Isolation isoDegree)
 {
     uint flags = 0;
     flags |= fast ? DbConstants.DB_FAST_STAT : 0;
     switch (isoDegree) {
         case Isolation.DEGREE_ONE:
             flags |= DbConstants.DB_READ_UNCOMMITTED;
             break;
         case Isolation.DEGREE_TWO:
             flags |= DbConstants.DB_READ_COMMITTED;
             break;
     }
     HeapStatStruct st = db.stat_heap(Transaction.getDB_TXN(txn), flags);
     return new HeapStats(st);
 }
Пример #14
0
 /// <summary>
 /// Return the database statistical information which does not require
 /// traversal of the database.
 /// </summary>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <returns>
 /// The database statistical information which does not require
 /// traversal of the database.
 /// </returns>
 public RecnoStats FastStats(Transaction txn)
 {
     return(Stats(txn, true, Isolation.DEGREE_THREE));
 }
Пример #15
0
 /// <summary>
 /// Return the database statistical information which does not require
 /// traversal of the database.
 /// </summary>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <returns>
 /// The database statistical information which does not require
 /// traversal of the database.
 /// </returns>
 public HeapStats FastStats(Transaction txn)
 {
     return Stats(txn, true, Isolation.DEGREE_THREE);
 }
Пример #16
0
 /// <summary>
 /// Return the database statistical information for this database.
 /// </summary>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <returns>Database statistical information.</returns>
 public RecnoStats Stats(Transaction txn)
 {
     return(Stats(txn, false, Isolation.DEGREE_THREE));
 }
Пример #17
0
 /// <summary>
 /// Return the database statistical information which does not require
 /// traversal of the database.
 /// </summary>
 /// <overloads>
 /// <para>
 /// Among other things, this method makes it possible for applications
 /// to request key and record counts without incurring the performance
 /// penalty of traversing the entire database.
 /// </para>
 /// <para>
 /// The statistical information is described by the
 /// <see cref="BTreeStats"/>, <see cref="HashStats"/>,
 /// <see cref="QueueStats"/>, and <see cref="RecnoStats"/> classes.
 /// </para>
 /// </overloads>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <param name="isoDegree">
 /// The level of isolation for database reads.
 /// <see cref="Isolation.DEGREE_ONE"/> will be silently ignored for
 /// databases which did not specify
 /// <see cref="DatabaseConfig.ReadUncommitted"/>.
 /// </param>
 /// <returns>
 /// The database statistical information which does not require
 /// traversal of the database.
 /// </returns>
 public RecnoStats FastStats(Transaction txn, Isolation isoDegree)
 {
     return(Stats(txn, true, isoDegree));
 }
Пример #18
0
 /// <summary>
 /// Create a transactionally protected secondary database cursor with
 /// the given configuration.
 /// </summary>
 /// <param name="cfg">
 /// The configuration properties for the cursor.
 /// </param>
 /// <param name="txn">
 /// The transaction context in which the cursor may be used.
 /// </param>
 /// <returns>A newly created cursor</returns>
 public SecondaryCursor SecondaryCursor(
     CursorConfig cfg, Transaction txn)
 {
     return(new SecondaryCursor(
                db.cursor(Transaction.getDB_TXN(txn), cfg.flags)));
 }
Пример #19
0
 /// <summary>
 /// Create a transactionally protected secondary database cursor.
 /// </summary>
 /// <param name="txn">
 /// The transaction context in which the cursor may be used.
 /// </param>
 /// <returns>A newly created cursor</returns>
 public SecondaryCursor SecondaryCursor(Transaction txn)
 {
     return(SecondaryCursor(new CursorConfig(), txn));
 }
Пример #20
0
        /// <summary>
        /// Instantiate a new SecondaryDatabase object, open the database
        /// represented by <paramref name="Filename"/> and associate the
        /// database with the <see cref="SecondaryDatabaseConfig.Primary">
        /// primary index</see>. The file specified by
        /// <paramref name="Filename"/> must exist.
        /// </summary>
        /// <remarks>
        /// <para>
        /// If <paramref name="Filename"/> is null and
        /// <paramref name="DatabaseName"/> is non-null, the database can be
        /// opened by other threads of control and will be replicated to client
        /// sites in any replication group.
        /// </para>
        /// <para>
        /// If <see cref="DatabaseConfig.AutoCommit"/> is set, the operation
        /// is implicitly transaction protected. Transactionally
        /// protected operations on a database object requires the object itself
        /// be transactionally protected during its open.
        /// </para>
        /// </remarks>
        /// <param name="Filename">
        /// The name of an underlying file used to back the
        /// database.
        /// </param>
        /// <param name="DatabaseName">
        /// This parameter allows applications to have multiple databases in a
        /// single file. Although no DatabaseName needs to be specified, it is
        /// an error to attempt to open a second database in a file that was not
        /// initially created using a database name.
        /// </param>
        /// <param name="cfg">The database's configuration</param>
        /// <param name="txn">
        /// If the operation is part of an application-specified transaction,
        /// <paramref name="txn"/> is a Transaction object returned from
        /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
        /// the operation is part of a Berkeley DB Concurrent Data Store group,
        /// <paramref name="txn"/> is a handle returned from
        /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
        /// </param>
        /// <returns>A new, open database object</returns>
        public static SecondaryDatabase Open(string Filename,
                                             string DatabaseName, SecondaryDatabaseConfig cfg, Transaction txn)
        {
            if (cfg.DbType == DatabaseType.BTREE)
            {
                return(SecondaryBTreeDatabase.Open(Filename,
                                                   DatabaseName, (SecondaryBTreeDatabaseConfig)cfg, txn));
            }
            else if (cfg.DbType == DatabaseType.HASH)
            {
                return(SecondaryHashDatabase.Open(Filename,
                                                  DatabaseName, (SecondaryHashDatabaseConfig)cfg, txn));
            }

            SecondaryDatabase ret = new SecondaryDatabase(cfg.Env, 0);

            ret.Config(cfg);
            ret.db.open(Transaction.getDB_TXN(txn), Filename,
                        DatabaseName, cfg.DbType.getDBTYPE(), cfg.openFlags, 0);
            ret.doAssocRef = new BDB_AssociateDelegate(doAssociate);
            cfg.Primary.db.associate(Transaction.getDB_TXN(txn),
                                     ret.db, ret.doAssocRef, cfg.assocFlags);

            if (cfg.ForeignKeyDatabase != null)
            {
                if (cfg.OnForeignKeyDelete == ForeignKeyDeleteAction.NULLIFY)
                {
                    ret.doNullifyRef =
                        new BDB_AssociateForeignDelegate(doNullify);
                }
                else
                {
                    ret.doNullifyRef = null;
                }
                cfg.ForeignKeyDatabase.db.associate_foreign(ret.db,
                                                            ret.doNullifyRef, cfg.foreignFlags);
            }
            return(ret);
        }
Пример #21
0
 /// <summary>
 /// Instantiate a new HeapDatabase object and open the database
 /// represented by <paramref name="Filename"/>.
 /// </summary>
 /// <remarks>
 /// <para>
 /// If <paramref name="Filename"/> is null, the database is strictly
 /// temporary and cannot be opened by any other thread of control, thus
 /// the database can only be accessed by sharing the single database
 /// object that created it, in circumstances where doing so is safe.
 /// </para>
 /// <para>
 /// If <paramref name="txn"/> is null, but
 /// <see cref="DatabaseConfig.AutoCommit"/> is set, the operation will
 /// be implicitly transaction protected. Note that transactionally
 /// protected operations on a datbase object requires the object itself
 /// be transactionally protected during its open. Also note that the
 /// transaction must be committed before the object is closed.
 /// </para>
 /// </remarks>
 /// <param name="Filename">
 /// The name of an underlying file that will be used to back the
 /// database. In-memory databases never intended to be preserved on disk
 /// may be created by setting this parameter to null.
 /// </param>
 /// <param name="cfg">The database's configuration</param>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <returns>A new, open database object</returns>
 public static HeapDatabase Open(
     string Filename, HeapDatabaseConfig cfg, Transaction txn)
 {
     HeapDatabase ret = new HeapDatabase(cfg.Env, 0);
     ret.Config(cfg);
     ret.db.open(Transaction.getDB_TXN(txn),
         Filename, null, DBTYPE.DB_HEAP, cfg.openFlags, 0);
     ret.isOpen = true;
     return ret;
 }
Пример #22
0
 /// <summary>
 /// Create a transactionally protected database cursor.
 /// </summary>
 /// <param name="txn">
 /// The transaction context in which the cursor may be used.
 /// </param>
 /// <returns>A newly created cursor</returns>
 public new RecnoCursor Cursor(Transaction txn)
 {
     return(Cursor(new CursorConfig(), txn));
 }
Пример #23
0
 /// <summary>
 /// Append the data item to the end of the database.
 /// </summary>
 /// <param name="data">The data item to store in the database</param>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <returns>The heap record id allocated to the record</returns>
 public HeapRecordId Append(DatabaseEntry data, Transaction txn)
 {
     DatabaseEntry key = new DatabaseEntry();
     Put(key, data, txn, DbConstants.DB_APPEND);
     return HeapRecordId.fromArray(key.Data);
 }
Пример #24
0
        /// <summary>
        /// Instantiate a new RecnoDatabase object and open the database
        /// represented by <paramref name="Filename"/> and
        /// <paramref name="DatabaseName"/>.
        /// </summary>
        /// <remarks>
        /// <para>
        /// If both <paramref name="Filename"/> and
        /// <paramref name="DatabaseName"/> are null, the database is strictly
        /// temporary and cannot be opened by any other thread of control, thus
        /// the database can only be accessed by sharing the single database
        /// object that created it, in circumstances where doing so is safe. If
        /// <paramref name="Filename"/> is null and
        /// <paramref name="DatabaseName"/> is non-null, the database can be
        /// opened by other threads of control and will be replicated to client
        /// sites in any replication group.
        /// </para>
        /// <para>
        /// If <paramref name="txn"/> is null, but
        /// <see cref="DatabaseConfig.AutoCommit"/> is set, the operation will
        /// be implicitly transaction protected. Note that transactionally
        /// protected operations on a datbase object requires the object itself
        /// be transactionally protected during its open. Also note that the
        /// transaction must be committed before the object is closed.
        /// </para>
        /// </remarks>
        /// <param name="Filename">
        /// The name of an underlying file that will be used to back the
        /// database. In-memory databases never intended to be preserved on disk
        /// may be created by setting this parameter to null.
        /// </param>
        /// <param name="DatabaseName">
        /// This parameter allows applications to have multiple databases in a
        /// single file. Although no DatabaseName needs to be specified, it is
        /// an error to attempt to open a second database in a file that was not
        /// initially created using a database name.
        /// </param>
        /// <param name="cfg">The database's configuration</param>
        /// <param name="txn">
        /// If the operation is part of an application-specified transaction,
        /// <paramref name="txn"/> is a Transaction object returned from
        /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
        /// the operation is part of a Berkeley DB Concurrent Data Store group,
        /// <paramref name="txn"/> is a handle returned from
        /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
        /// </param>
        /// <returns>A new, open database object</returns>
        public static RecnoDatabase Open(string Filename,
                                         string DatabaseName, RecnoDatabaseConfig cfg, Transaction txn)
        {
            RecnoDatabase ret = new RecnoDatabase(cfg.Env, 0);

            ret.Config(cfg);
            ret.db.open(Transaction.getDB_TXN(txn),
                        Filename, DatabaseName, DBTYPE.DB_RECNO, cfg.openFlags, 0);
            ret.isOpen = true;
            return(ret);
        }
Пример #25
0
 /// <summary>
 /// Return the database statistical information which does not require
 /// traversal of the database.
 /// </summary>
 /// <overloads>
 /// <para>
 /// Among other things, this method makes it possible for applications
 /// to request key and record counts without incurring the performance
 /// penalty of traversing the entire database. 
 /// </para>
 /// <para>
 /// The statistical information is described by the
 /// <see cref="BTreeStats"/>, <see cref="HashStats"/>,
 /// <see cref="HeapStats"/>, <see cref="QueueStats"/>, and 
 /// <see cref="RecnoStats"/> classes. 
 /// </para>
 /// </overloads>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <param name="isoDegree">
 /// The level of isolation for database reads.
 /// <see cref="Isolation.DEGREE_ONE"/> will be silently ignored for 
 /// databases which did not specify
 /// <see cref="DatabaseConfig.ReadUncommitted"/>.
 /// </param>
 /// <returns>
 /// The database statistical information which does not require
 /// traversal of the database.
 /// </returns>
 public HeapStats FastStats(Transaction txn, Isolation isoDegree)
 {
     return Stats(txn, true, isoDegree);
 }
Пример #26
0
 /// <summary>
 /// Instantiate a new Database object and open the database represented
 /// by <paramref name="Filename"/> and <paramref name="DatabaseName"/>. 
 /// The file specified by <paramref name="Filename"/> must exist.
 /// </summary>
 /// <remarks>
 /// <para>
 /// If both <paramref name="Filename"/> and
 /// <paramref name="DatabaseName"/> are null, the database is strictly
 /// temporary and cannot be opened by any other thread of control, thus
 /// the database can only be accessed by sharing the single database 
 /// object that created it, in circumstances where doing so is safe. If
 /// <paramref name="Filename"/> is null and
 /// <paramref name="DatabaseName"/> is non-null, the database can be
 /// opened by other threads of control and be replicated to client
 /// sites in any replication group.
 /// </para>
 /// <para>
 /// If <paramref name="txn"/> is null, but
 /// <see cref="DatabaseConfig.AutoCommit"/> is set, the operation
 /// is implicitly transaction protected. Transactionally
 /// protected operations on a database object requires the object itself
 /// be transactionally protected during its open. The
 /// transaction must be committed before the object is closed.
 /// </para>
 /// </remarks>
 /// <param name="Filename">
 /// The name of an underlying file used to back the
 /// database. In-memory databases never intended to be preserved on disk
 /// may be created by setting this parameter to null.
 /// </param>
 /// <param name="DatabaseName">
 /// This parameter allows applications to have multiple databases in a
 /// single file. Although no DatabaseName needs to be specified, it is
 /// an error to attempt to open a second database in a file that was not
 /// initially created using a database name.
 /// </param>
 /// <param name="cfg">The database's configuration</param>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <returns>A new, open database object</returns>
 public static new Database Open(string Filename,
     string DatabaseName, DatabaseConfig cfg, Transaction txn)
 {
     Database ret;
     BaseDatabase db = BaseDatabase.Open(
         Filename, DatabaseName, cfg, txn);
     switch (db.Type.getDBTYPE()) {
         case DBTYPE.DB_BTREE:
             ret = new BTreeDatabase(db);
             break;
         case DBTYPE.DB_HASH:
             ret = new HashDatabase(db);
             break;
         case DBTYPE.DB_HEAP:
             ret = new HeapDatabase(db);
             break;
         case DBTYPE.DB_QUEUE:
             ret = new QueueDatabase(db);
             break;
         case DBTYPE.DB_RECNO:
             ret = new RecnoDatabase(db);
             break;
         default:
             throw new DatabaseException(0);
     }
     db.Dispose();
     ret.isOpen = true;
     return ret;
 }
Пример #27
0
 /// <summary>
 /// Return the database statistical information for this database.
 /// </summary>
 /// <overloads>
 /// The statistical information is described by
 /// <see cref="HeapStats"/>. 
 /// </overloads>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <param name="isoDegree">
 /// The level of isolation for database reads.
 /// <see cref="Isolation.DEGREE_ONE"/> will be silently ignored for 
 /// databases which did not specify
 /// <see cref="DatabaseConfig.ReadUncommitted"/>.
 /// </param>
 /// <returns>Database statistical information.</returns>
 public HeapStats Stats(Transaction txn, Isolation isoDegree)
 {
     return Stats(txn, false, isoDegree);
 }
Пример #28
0
 /// <summary>
 /// Retrieve a key and all duplicate data items from the database.
 /// </summary>
 /// <param name="key">The key to search for</param>
 /// <param name="BufferSize">
 /// The initial size of the buffer to fill with duplicate data items. If
 /// the buffer is not large enough, it is automatically resized.
 /// </param>
 /// <param name="txn">
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <returns>
 /// A <see cref="KeyValuePair{T,T}"/>
 /// whose Key parameter is <paramref name="key"/> and whose Value
 /// parameter is the retrieved data items.
 /// </returns>
 public KeyValuePair<DatabaseEntry, MultipleDatabaseEntry> GetMultiple(
     DatabaseEntry key, int BufferSize, Transaction txn)
 {
     return GetMultiple(key, BufferSize, txn, null);
 }
Пример #29
0
 /// <summary>
 /// Store multiple data items using keys from the buffer to which the
 /// key parameter refers and data values from the buffer to which the
 /// data parameter refers. A successful bulk operation is logically 
 /// equivalent to a loop through each key/data pair, performing a Put
 /// for each one. 
 /// </summary>
 /// <param name="key">Multiple key/data pairs to store in the database
 /// </param>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 public void Put(MultipleKeyDatabaseEntry key, Transaction txn)
 {
     Put(key, null, txn, 0);
 }
Пример #30
0
 /// <summary>
 /// Instantiate a new SecondaryDatabase object, open the database
 /// represented by <paramref name="Filename"/> and associate the
 /// database with the <see cref="SecondaryDatabaseConfig.Primary">
 /// primary index</see>. The file specified by
 /// <paramref name="Filename"/> must exist.
 /// </summary>
 /// <remarks>
 /// <para>
 /// If <see cref="DatabaseConfig.AutoCommit"/> is set, the operation
 /// is implicitly transaction protected. Transactionally
 /// protected operations on a database object requires the object itself
 /// be transactionally protected during its open.
 /// </para>
 /// </remarks>
 /// <param name="Filename">
 /// The name of an underlying file used to back the
 /// database.
 /// </param>
 /// <param name="cfg">The database's configuration</param>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <returns>A new, open database object</returns>
 public static SecondaryDatabase Open(string Filename,
     SecondaryDatabaseConfig cfg, Transaction txn) {
     return Open(Filename, null, cfg, txn);
 }
Пример #31
0
 /// <summary>
 /// Store the key/data pairs in the database, only if the key does not
 /// already appear in the database.
 /// </summary>
 /// <param name="key">Key/data pairs to store in the database</param>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 public void PutNoOverwrite(
     MultipleKeyDatabaseEntry key, Transaction txn)
 {
     Put(key, null, txn, DbConstants.DB_NOOVERWRITE);
 }
Пример #32
0
 /// <summary>
 /// Create a transactionally protected secondary database cursor.
 /// </summary>
 /// <param name="txn">
 /// The transaction context in which the cursor may be used.
 /// </param>
 /// <returns>A newly created cursor</returns>
 public SecondaryCursor SecondaryCursor(Transaction txn) {
     return SecondaryCursor(new CursorConfig(), txn);
 }
Пример #33
0
 /// <summary>
 /// Protected wrapper for DB->put.  Used by subclasses for access method
 /// specific operations.
 /// </summary>
 /// <param name="key">The key to store in the database</param>
 /// <param name="data">The data item to store in the database</param>
 /// <param name="txn">Transaction with which to protect the put</param>
 /// <param name="flags">Flags to pass to DB->put</param>
 protected void Put(DatabaseEntry key,
     DatabaseEntry data, Transaction txn, uint flags)
 {
     System.Type type = key.GetType();
     if (type == typeof(MultipleDatabaseEntry))
         flags |= DbConstants.DB_MULTIPLE;
     else if (type == typeof(MultipleKeyDatabaseEntry))
         flags |= DbConstants.DB_MULTIPLE_KEY;
     db.put(Transaction.getDB_TXN(txn), key, data, flags);
 }
Пример #34
0
 /// <summary>
 /// Return the database statistical information for this database.
 /// </summary>
 /// <overloads>
 /// The statistical information is described by
 /// <see cref="BTreeStats"/>.
 /// </overloads>
 /// <param name="txn">
 /// If the operation is part of an application-specified transaction,
 /// <paramref name="txn"/> is a Transaction object returned from
 /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
 /// the operation is part of a Berkeley DB Concurrent Data Store group,
 /// <paramref name="txn"/> is a handle returned from
 /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
 /// </param>
 /// <param name="isoDegree">
 /// The level of isolation for database reads.
 /// <see cref="Isolation.DEGREE_ONE"/> will be silently ignored for
 /// databases which did not specify
 /// <see cref="DatabaseConfig.ReadUncommitted"/>.
 /// </param>
 /// <returns>Database statistical information.</returns>
 public RecnoStats Stats(Transaction txn, Isolation isoDegree)
 {
     return(Stats(txn, false, isoDegree));
 }
Пример #35
0
        /// <summary>
        /// If a key/data pair in the database matches <paramref name="key"/>
        /// and <paramref name="data"/>, return the key and all duplicate data
        /// items.
        /// </summary>
        /// <param name="key">The key to search for</param>
        /// <param name="data">The data to search for</param>
        /// <param name="BufferSize">
        /// The initial size of the buffer to fill with duplicate data items. If
        /// the buffer is not large enough, it is automatically resized.
        /// </param>
        /// <param name="txn">
        /// <paramref name="txn"/> is a Transaction object returned from
        /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
        /// the operation is part of a Berkeley DB Concurrent Data Store group,
        /// <paramref name="txn"/> is a handle returned from
        /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
        /// </param>
        /// <param name="info">The locking behavior to use.</param>
        /// <exception cref="NotFoundException">
        /// A NotFoundException is thrown if <paramref name="key"/> and
        /// <paramref name="data"/> are not in the database. 
        /// </exception>
        /// <exception cref="KeyEmptyException">
        /// A KeyEmptyException is thrown if the database is a
        /// <see cref="QueueDatabase"/> or <see cref="RecnoDatabase"/> 
        /// database and <paramref name="key"/> exists, but was never explicitly
        /// created by the application or was later deleted.
        /// </exception>
        /// <returns>
        /// A <see cref="KeyValuePair{T,T}"/>
        /// whose Key parameter is <paramref name="key"/> and whose Value
        /// parameter is the retrieved data items.
        /// </returns>
        public KeyValuePair<DatabaseEntry, MultipleDatabaseEntry> GetBothMultiple(
            DatabaseEntry key, DatabaseEntry data,
            int BufferSize, Transaction txn, LockingInfo info)
        {
            KeyValuePair<DatabaseEntry, DatabaseEntry> kvp;
            int datasz = (int)data.Data.Length;

            for (; ; ) {
                byte[] udata = new byte[BufferSize];
                Array.Copy(data.Data, udata, datasz);
                data.UserData = udata;
                data.size = (uint)datasz;
                try {
                    kvp = Get(key, data, txn, info,
                        DbConstants.DB_MULTIPLE | DbConstants.DB_GET_BOTH);
                    break;
                } catch (MemoryException) {
                    int sz = (int)data.size;
                    if (sz > BufferSize)
                        BufferSize = sz;
                    else
                        BufferSize *= 2;
                }
            }
            MultipleDatabaseEntry dbe = new MultipleDatabaseEntry(kvp.Value);
            return new KeyValuePair<DatabaseEntry, MultipleDatabaseEntry>(
                kvp.Key, dbe);
        }
Пример #36
0
        public void UpdateTxn()
        {
            int int32Value;
            DatabaseEntry data;

            // Get a new transaction for updating the db.
            TransactionConfig txnConfig =
                new TransactionConfig();
            txnConfig.IsolationDegree =
                Isolation.DEGREE_THREE;

            updateTxn =
                paramEnv.BeginTransaction(txnConfig);

            // Continually putting record to db.

            BTreeCursor cursor =
                paramDB.Cursor(updateTxn);

            // Move the cursor to the first record.
            Assert.IsTrue(cursor.MoveFirst());
            int i = 0;
            try
            {
                do
                {

                    int32Value = BitConverter.ToInt32(
                         cursor.Current.Value.Data, 0);
                    data = new DatabaseEntry(
                         BitConverter.GetBytes(int32Value - 1));
                    cursor.Overwrite(data);
                } while (i <= 1000 && cursor.MoveNext());
            }
            catch (DeadlockException)
            {
            }
            finally
            {
                cursor.Close();
            }
        }
Пример #37
0
        /// <summary>
        /// Retrieve a key and all duplicate data items from the database.
        /// </summary>
        /// <param name="key">The key to search for</param>
        /// <param name="BufferSize">
        /// The initial size of the buffer to fill with duplicate data items. If
        /// the buffer is not large enough, it is automatically resized.
        /// </param>
        /// <param name="txn">
        /// <paramref name="txn"/> is a Transaction object returned from
        /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
        /// the operation is part of a Berkeley DB Concurrent Data Store group,
        /// <paramref name="txn"/> is a handle returned from
        /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
        /// </param>
        /// <param name="info">The locking behavior to use.</param>
        /// <returns>
        /// A <see cref="KeyValuePair{T,T}"/>
        /// whose Key parameter is <paramref name="key"/> and whose Value
        /// parameter is the retrieved data items.
        /// </returns>
        public KeyValuePair<DatabaseEntry, MultipleDatabaseEntry> GetMultiple(
            DatabaseEntry key,
            int BufferSize, Transaction txn, LockingInfo info)
        {
            KeyValuePair<DatabaseEntry, DatabaseEntry> kvp;

            DatabaseEntry data = new DatabaseEntry();
            for (; ; ) {
                data.UserData = new byte[BufferSize];
                try {
                    kvp = Get(key, data, txn, info, DbConstants.DB_MULTIPLE);
                    break;
                } catch (MemoryException) {
                    int sz = (int)data.size;
                    if (sz > BufferSize)
                        BufferSize = sz;
                    else
                        BufferSize *= 2;
                }
            }
            MultipleDatabaseEntry dbe = new MultipleDatabaseEntry(kvp.Value);
            return new KeyValuePair<DatabaseEntry, MultipleDatabaseEntry>(
                kvp.Key, dbe);
        }
Пример #38
0
        /*
         * Configure a transactional cursor to have degree 1
         * isolation. The cursor's read operations could return
         * modified but not yet commited data.
         */
        public void CursorReadUncommited(
		    DatabaseEnvironment env, BTreeDatabase db,
		    Cursor cursor, Transaction txn)
        {
            Console.WriteLine("CursorReadUncommited");
        }
Пример #39
0
        /// <summary>
        /// Instantiate a new SecondaryDatabase object, open the database
        /// represented by <paramref name="Filename"/> and associate the
        /// database with the <see cref="SecondaryDatabaseConfig.Primary">
        /// primary index</see>. The file specified by
        /// <paramref name="Filename"/> must exist.
        /// </summary>
        /// <remarks>
        /// <para>
        /// If <paramref name="Filename"/> is null and 
        /// <paramref name="DatabaseName"/> is non-null, the database can be
        /// opened by other threads of control and will be replicated to client
        /// sites in any replication group.
        /// </para>
        /// <para>
        /// If <see cref="DatabaseConfig.AutoCommit"/> is set, the operation
        /// is implicitly transaction protected. Transactionally
        /// protected operations on a database object requires the object itself
        /// be transactionally protected during its open.
        /// </para>
        /// </remarks>
        /// <param name="Filename">
        /// The name of an underlying file used to back the
        /// database.
        /// </param>
        /// <param name="DatabaseName">
        /// This parameter allows applications to have multiple databases in a
        /// single file. Although no DatabaseName needs to be specified, it is
        /// an error to attempt to open a second database in a file that was not
        /// initially created using a database name.
        /// </param>
        /// <param name="cfg">The database's configuration</param>
        /// <param name="txn">
        /// If the operation is part of an application-specified transaction,
        /// <paramref name="txn"/> is a Transaction object returned from
        /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
        /// the operation is part of a Berkeley DB Concurrent Data Store group,
        /// <paramref name="txn"/> is a handle returned from
        /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
        /// </param>
        /// <returns>A new, open database object</returns>
        public static SecondaryDatabase Open(string Filename,
            string DatabaseName, SecondaryDatabaseConfig cfg, Transaction txn) {
            if (cfg.DbType == DatabaseType.BTREE) {
                return SecondaryBTreeDatabase.Open(Filename,
                    DatabaseName, (SecondaryBTreeDatabaseConfig)cfg, txn);
            } else if (cfg.DbType == DatabaseType.HASH) {
               return SecondaryHashDatabase.Open(Filename,
                   DatabaseName, (SecondaryHashDatabaseConfig)cfg, txn);
            }

            SecondaryDatabase ret = new SecondaryDatabase(cfg.Env, 0);
            ret.Config(cfg);
            ret.db.open(Transaction.getDB_TXN(txn), Filename,
                DatabaseName, cfg.DbType.getDBTYPE(), cfg.openFlags, 0);
            ret.doAssocRef = new BDB_AssociateDelegate(doAssociate);
            cfg.Primary.db.associate(Transaction.getDB_TXN(txn),
                ret.db, ret.doAssocRef, cfg.assocFlags);

            if (cfg.ForeignKeyDatabase != null) {
                if (cfg.OnForeignKeyDelete == ForeignKeyDeleteAction.NULLIFY)
                    ret.doNullifyRef =
                        new BDB_AssociateForeignDelegate(doNullify);
                else
                    ret.doNullifyRef = null;
                cfg.ForeignKeyDatabase.db.associate_foreign(ret.db,
                    ret.doNullifyRef, cfg.foreignFlags);
            }
            return ret;
        }
Пример #40
0
        public void ReadTxn()
        {
            // Get a new transaction for reading the db.
            TransactionConfig txnConfig =
                new TransactionConfig();
            txnConfig.Snapshot = true;
            readTxn = paramEnv.BeginTransaction(
                txnConfig);

            // Get a new cursor for putting record into db.
            CursorConfig cursorConfig = new CursorConfig();
            cursorConfig.WriteCursor = false;
            BTreeCursor cursor = paramDB.Cursor(
                cursorConfig, readTxn);

            // Continually reading record from db.
            try
            {
                Assert.IsTrue(cursor.MoveFirst());
                int i = 0;
                do
                {
                    Assert.AreEqual(
                        BitConverter.ToInt32(
                        cursor.Current.Key.Data, 0),
                        BitConverter.ToInt32(
                        cursor.Current.Value.Data, 0));
                } while (i <= 1000 && cursor.MoveNext());
            }
            catch (DeadlockException)
            {
            }
            finally
            {
                cursor.Close();
            }
        }
Пример #41
0
 /// <summary>
 /// Create a transactionally protected secondary database cursor with
 /// the given configuration.
 /// </summary>
 /// <param name="cfg">
 /// The configuration properties for the cursor.
 /// </param>
 /// <param name="txn">
 /// The transaction context in which the cursor may be used.
 /// </param>
 /// <returns>A newly created cursor</returns>
 public SecondaryCursor SecondaryCursor(
     CursorConfig cfg, Transaction txn) {
     return new SecondaryCursor(
         db.cursor(Transaction.getDB_TXN(txn), cfg.flags));
 }
Пример #42
0
 internal PreparedTransaction(DB_PREPLIST prep)
 {
     trans = new Transaction(prep.txn);
     txnid = prep.gid;
 }