当前位置: 首页>>代码示例>>C#>>正文


C# BTreeDatabase.Cursor方法代码示例

本文整理汇总了C#中BerkeleyDB.BTreeDatabase.Cursor方法的典型用法代码示例。如果您正苦于以下问题:C# BTreeDatabase.Cursor方法的具体用法?C# BTreeDatabase.Cursor怎么用?C# BTreeDatabase.Cursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BerkeleyDB.BTreeDatabase的用法示例。


在下文中一共展示了BTreeDatabase.Cursor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCursorInBtreeDBUsingRecno

        public void GetCursorInBtreeDBUsingRecno(string home,
		    string name, out BTreeDatabase db,
		    out BTreeCursor cursor)
        {
            string dbFileName = home + "/" + name + ".db";
            BTreeDatabaseConfig dbConfig = new BTreeDatabaseConfig();
            dbConfig.UseRecordNumbers = true;
            dbConfig.Creation = CreatePolicy.IF_NEEDED;
            db = BTreeDatabase.Open(dbFileName, dbConfig);
            cursor = db.Cursor();
        }
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:11,代码来源:BTreeCursorTest.cs

示例2: GetCursorInBtreeDB

        public static void GetCursorInBtreeDB(
		    string home, string name,
		    CursorConfig cursorConfig,
		    out DatabaseEnvironment env, out BTreeDatabase db,
		    out BTreeCursor cursor)
        {
            string dbFileName = name + ".db";

            Configuration.ClearDir(home);

            // Open an environment.
            DatabaseEnvironmentConfig envConfig =
                new DatabaseEnvironmentConfig();
            envConfig.Create = true;
            envConfig.UseMPool = true;
            envConfig.UseTxns = true;
            envConfig.NoMMap = false;
            envConfig.UseLocking = true;
            env = DatabaseEnvironment.Open(home, envConfig);

            /*
             * Open an btree database. The underlying database
             * should be opened with ReadUncommitted if the
             * cursor's isolation degree will be set to be 1.
             */
            BTreeDatabaseConfig dbConfig = new BTreeDatabaseConfig();
            dbConfig.Creation = CreatePolicy.IF_NEEDED;
            dbConfig.Env = env;
            if (cursorConfig.IsolationDegree == Isolation.DEGREE_ONE)
                dbConfig.ReadUncommitted = true;

            db = BTreeDatabase.Open(dbFileName, dbConfig, null);

            // Get a cursor in the transaction.
            cursor = db.Cursor(cursorConfig, null);
        }
开发者ID:gildafnai82,项目名称:craq,代码行数:36,代码来源:CursorTest.cs

示例3: GetCursorInBtreeDBWithoutEnv

        public static void GetCursorInBtreeDBWithoutEnv(
		    string home, string name, out BTreeDatabase db,
		    out BTreeCursor cursor)
        {
            string dbFileName = home + "/" + name + ".db";

            BTreeDatabaseConfig dbConfig =
                new BTreeDatabaseConfig();
            dbConfig.Creation = CreatePolicy.IF_NEEDED;
            dbConfig.Duplicates = DuplicatesPolicy.UNSORTED;
            db = BTreeDatabase.Open(dbFileName, dbConfig);
            cursor = db.Cursor();
        }
开发者ID:gildafnai82,项目名称:craq,代码行数:13,代码来源:CursorTest.cs

示例4: GetMultipleDB

        private void GetMultipleDB(string dbFileName, 
		    BTreeDatabaseConfig dbConfig, Transaction txn, 
		    out BTreeDatabase db, out BTreeCursor cursor)
        {
            if (txn == null) {
                db = BTreeDatabase.Open(dbFileName, dbConfig);
                cursor = db.Cursor();
            } else {
                db = BTreeDatabase.Open(
                    dbFileName, dbConfig, txn);
                CursorConfig cursorConfig = new CursorConfig();
                cursor = db.Cursor(cursorConfig, txn);
            }

            KeyValuePair<DatabaseEntry, DatabaseEntry> pair;
            DatabaseEntry key, data;
            for (int i = 1; i < 100; i++) {
                key = new DatabaseEntry(BitConverter.GetBytes(i));
                data = new DatabaseEntry(BitConverter.GetBytes(i));
                pair = new KeyValuePair<DatabaseEntry, DatabaseEntry>(key, data);
                cursor.Add(pair);
            }

            if (dbConfig.UseRecordNumbers == true) {
                byte[] bytes = new byte[512];
                for (int i = 0; i < 512; i++)
                    bytes[i] = (byte)i;
                key = new DatabaseEntry(BitConverter.GetBytes(100));
                data = new DatabaseEntry(bytes);
                pair = new KeyValuePair<DatabaseEntry, DatabaseEntry>(key, data);
                cursor.Add(pair);
            } else {
                if (dbConfig.Duplicates == DuplicatesPolicy.UNSORTED ||
                    dbConfig.Duplicates == DuplicatesPolicy.SORTED) {
                    key = new DatabaseEntry(BitConverter.GetBytes(99));
                    data = new DatabaseEntry(BitConverter.GetBytes(100));
                    pair = new KeyValuePair<DatabaseEntry, DatabaseEntry>(key, data);
                    cursor.Add(pair);
                }

                key = new DatabaseEntry(BitConverter.GetBytes(101));
                data = new DatabaseEntry(BitConverter.GetBytes(101));
                pair = new KeyValuePair<DatabaseEntry, DatabaseEntry>(key, data);
                cursor.Add(pair);
            }
        }
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:46,代码来源:BTreeCursorTest.cs


注:本文中的BerkeleyDB.BTreeDatabase.Cursor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。