• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# BerkeleyDB.DatabaseConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



DatabaseConfig类属于BerkeleyDB命名空间,在下文中一共展示了DatabaseConfig类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Confirm

 public static void Confirm(XmlElement xmlElement,
     DatabaseConfig dbConfig, bool compulsory)
 {
     Configuration.ConfirmBool(xmlElement, "AutoCommit",
         dbConfig.AutoCommit, compulsory);
     Configuration.ConfirmByteOrder(xmlElement, "ByteOrder",
         dbConfig.ByteOrder, compulsory);
     Configuration.ConfirmCacheSize(xmlElement, "CacheSize",
         dbConfig.CacheSize, compulsory);
     Configuration.ConfirmBool(xmlElement, "DoChecksum",
         dbConfig.DoChecksum, compulsory);
     Configuration.ConfirmEncryption(xmlElement, "Encryption",
         dbConfig.EncryptionPassword,
         dbConfig.EncryptAlgorithm, compulsory);
     Configuration.ConfirmString(xmlElement, "ErrorPrefix",
         dbConfig.ErrorPrefix, compulsory);
     Configuration.ConfirmBool(xmlElement, "FreeThreaded",
         dbConfig.FreeThreaded, compulsory);
     Configuration.ConfirmBool(xmlElement, "NoMMap",
         dbConfig.NoMMap, compulsory);
     Configuration.ConfirmBool(xmlElement, "NonDurableTxns",
         dbConfig.NonDurableTxns, compulsory);
     Configuration.ConfirmUint(xmlElement, "PageSize",
         dbConfig.PageSize, compulsory);
     Configuration.ConfirmCachePriority(xmlElement,
         "Priority", dbConfig.Priority, compulsory);
     Configuration.ConfirmBool(xmlElement, "ReadOnly",
         dbConfig.ReadOnly, compulsory);
     Configuration.ConfirmBool(xmlElement, "ReadUncommitted",
         dbConfig.ReadUncommitted, compulsory);
     Configuration.ConfirmBool(xmlElement, "Truncate",
         dbConfig.Truncate, compulsory);
     Configuration.ConfirmBool(xmlElement, "UseMVCC",
         dbConfig.UseMVCC, compulsory);
 }
开发者ID:kanbang,项目名称:Colt,代码行数:35,代码来源:DatabaseConfigTest.cs


示例2: Config

        internal void Config(DatabaseConfig cfg) {
            // The cache size cannot change.
            if (cfg.CacheSize != null)
                db.set_cachesize(cfg.CacheSize.Gigabytes,
                    cfg.CacheSize.Bytes, cfg.CacheSize.NCaches);
            if (cfg.encryptionIsSet)
                db.set_encrypt(
                    cfg.EncryptionPassword, (uint)cfg.EncryptAlgorithm);
            if (cfg.ErrorPrefix != null)
                ErrorPrefix = cfg.ErrorPrefix;
            if (cfg.ErrorFeedback != null)
                ErrorFeedback = cfg.ErrorFeedback;
            if (cfg.Feedback != null)
                Feedback = cfg.Feedback;

            db.set_flags(cfg.flags);
            if (cfg.ByteOrder != ByteOrder.MACHINE)
                db.set_lorder(cfg.ByteOrder.lorder);
            if (cfg.NoWaitDbExclusiveLock == true)
                db.set_lk_exclusive(1);
            else if (cfg.NoWaitDbExclusiveLock == false)
                db.set_lk_exclusive(0);
            if (cfg.pagesizeIsSet)
                db.set_pagesize(cfg.PageSize);
            if (cfg.Priority != CachePriority.DEFAULT)
                db.set_priority(cfg.Priority.priority);
        }
开发者ID:rohitlodha,项目名称:DenverDB,代码行数:27,代码来源:BaseDatabase.cs


示例3: Config

        public static void Config(XmlElement xmlElement,
            ref DatabaseConfig dbConfig, bool compulsory)
        {
            uint pageSize = new uint();

            Configuration.ConfigBool(xmlElement, "AutoCommit",
                ref dbConfig.AutoCommit, compulsory);
            Configuration.ConfigByteOrder(xmlElement, "ByteOrder",
                ref dbConfig.ByteOrder, compulsory);
            Configuration.ConfigCacheInfo(xmlElement, "CacheSize",
                ref dbConfig.CacheSize, compulsory);
            Configuration.ConfigBool(xmlElement, "DoChecksum",
                ref dbConfig.DoChecksum, compulsory);
            Configuration.ConfigString(xmlElement, "ErrorPrefix",
                ref dbConfig.ErrorPrefix, compulsory);
            Configuration.ConfigBool(xmlElement, "FreeThreaded",
                ref dbConfig.FreeThreaded, compulsory);
            Configuration.ConfigBool(xmlElement, "NoMMap",
                ref dbConfig.NoMMap, compulsory);
            Configuration.ConfigBool(xmlElement, "NonDurableTxns",
                ref dbConfig.NonDurableTxns, compulsory);
            if (Configuration.ConfigUint(xmlElement, "PageSize",
                ref pageSize, compulsory))
                dbConfig.PageSize = pageSize;
            Configuration.ConfigCachePriority(xmlElement,
                "Priority", ref dbConfig.Priority, compulsory);
            Configuration.ConfigBool(xmlElement, "ReadOnly",
                ref dbConfig.ReadOnly, compulsory);
            Configuration.ConfigBool(xmlElement, "ReadUncommitted",
                ref dbConfig.ReadUncommitted, compulsory);
            Configuration.ConfigEncryption(xmlElement,
                "Encryption", dbConfig, compulsory);
            Configuration.ConfigBool(xmlElement, "Truncate",
                ref dbConfig.Truncate, compulsory);
            Configuration.ConfigBool(xmlElement, "UseMVCC",
                ref dbConfig.UseMVCC, compulsory);
        }
开发者ID:kanbang,项目名称:Colt,代码行数:37,代码来源:DatabaseConfigTest.cs


示例4: Open

 /// <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;
 }
开发者ID:simonzhangsm,项目名称:h-store,代码行数:76,代码来源:Database.cs


示例5: TestConfigWithoutEnv

        public virtual void TestConfigWithoutEnv()
        {
            string testName = "TestConfigWithoutEnv";
            string testFixtureName = "DatabaseConfigTest";

            XmlElement xmlElem = Configuration.TestSetUp(
                testFixtureName, testName);
            DatabaseConfig dbConfig = new DatabaseConfig();
            Config(xmlElem, ref dbConfig, true);
            Confirm(xmlElem, dbConfig, true);
        }
开发者ID:kanbang,项目名称:Colt,代码行数:11,代码来源:DatabaseConfigTest.cs


示例6: Verify

 /// <summary>
 /// Verify the integrity of all databases in the file specified by 
 /// <paramref name="file"/>.
 /// </summary>
 /// <remarks>
 /// <para>
 /// Berkeley DB normally verifies that btree keys and duplicate items
 /// are correctly sorted, and hash keys are correctly hashed. If the
 /// file being verified contains multiple databases using differing
 /// sorting or hashing algorithms, some of them must necessarily fail
 /// database verification because only one sort order or hash function
 /// can be specified in <paramref name="cfg"/>. To verify files with
 /// multiple databases having differing sorting orders or hashing
 /// functions, first perform verification of the file as a whole by
 /// using <see cref="VerifyOperation.NO_ORDER_CHECK"/>, and then
 /// individually verify the sort order and hashing function for each
 /// database in the file using
 /// <see cref="VerifyOperation.ORDER_CHECK_ONLY"/>.
 /// </para>
 /// </remarks>
 /// <param name="file">
 /// The physical file in which the databases to be verified are found.
 /// </param>
 /// <param name="cfg">
 /// Configuration parameters for the databases to be verified.
 /// </param>
 /// <param name="op">The extent of verification</param>
 public static void Verify(
     string file, DatabaseConfig cfg, VerifyOperation op)
 {
     Verify(file, null, cfg, op);
 }
开发者ID:simonzhangsm,项目名称:h-store,代码行数:32,代码来源:Database.cs


示例7: Upgrade

 /// <summary>
 /// Upgrade all of the databases included in the file
 /// <paramref name="file"/>, if necessary. If no upgrade is necessary,
 /// Upgrade always returns successfully.
 /// </summary>
 /// <overloads>
 /// Database upgrades are done in place and are destructive. For
 /// example, if pages need to be allocated and no disk space is
 /// available, the database may be left corrupted. Backups should be
 /// made before databases are upgraded. See Upgrading databases in the
 /// Programmer's Reference Guide for more information.
 /// </overloads>
 /// <remarks>
 /// <para>
 /// As part of the upgrade from the Berkeley DB 3.0 release to the 3.1
 /// release, the on-disk format of duplicate data items changed. To
 /// correctly upgrade the format requires applications to specify
 /// whether duplicate data items in the database are sorted or not.
 /// Specifying <paramref name="dupSortUpgraded"/> informs Upgrade that
 /// the duplicates are sorted; otherwise they are assumed to be
 /// unsorted. Incorrectly specifying the value of this flag may lead to
 /// database corruption.
 /// </para>
 /// <para>
 /// Further, because this method upgrades a physical file (including all
 /// the databases it contains), it is not possible to use Upgrade to
 /// upgrade files in which some of the databases it includes have sorted
 /// duplicate data items, and some of the databases it includes have
 /// unsorted duplicate data items. If the file does not have more than a
 /// single database, if the databases do not support duplicate data
 /// items, or if all of the databases that support duplicate data items
 /// support the same style of duplicates (either sorted or unsorted), 
 /// Upgrade works correctly as long as
 /// <paramref name="dupSortUpgraded"/> is correctly specified.
 /// Otherwise, the file cannot be upgraded using Upgrade it must be
 /// upgraded manually by dumping and reloading the databases.
 /// </para>
 /// </remarks>
 /// <param name="file">
 /// The physical file containing the databases to be upgraded.
 /// </param>
 /// <param name="cfg">
 /// Configuration parameters for the databases to be upgraded.
 /// </param>
 /// <param name="dupSortUpgraded">
 /// If true, the duplicates in the upgraded database are sorted;
 /// otherwise they are assumed to be unsorted.  This setting is only 
 /// meaningful when upgrading databases from releases before the
 /// Berkeley DB 3.1 release.
 /// </param>
 public static void Upgrade(
     string file, DatabaseConfig cfg, bool dupSortUpgraded)
 {
     Database db = new Database(cfg.Env, 0);
     db.Config(cfg);
     db.db.upgrade(file, dupSortUpgraded ? DbConstants.DB_DUPSORT : 0);
 }
开发者ID:simonzhangsm,项目名称:h-store,代码行数:57,代码来源:Database.cs


示例8: Salvage

 /// <summary>
 /// Write the key/data pairs from all databases in the file to 
 /// <paramref name="OutputStream"/>. Key values are written for Btree,
 /// Hash and Queue databases, but not for Recno databases.
 /// </summary>
 /// <param name="file">
 /// The physical file in which the databases to be salvaged are found.
 /// </param>
 /// <param name="cfg">
 /// Configuration parameters for the databases to be salvaged.
 /// </param>
 /// <param name="Printable">
 /// If true and characters in either the key or data items are printing
 /// characters (as defined by isprint(3)), use printing characters to
 /// represent them. This setting permits users to use standard text
 /// editors and tools to modify the contents of databases or selectively
 /// remove data from salvager output. 
 /// </param>
 /// <param name="Aggressive">
 /// If true, output all the key/data pairs found in the file.
 /// Corruption of these data pairs is assumed, and corrupted or deleted
 /// data pairs may appear in the output (even if the salvaged file is in no
 /// way corrupt). This output almost certainly requires editing before being
 /// loaded into a database.
 /// </param>
 /// <param name="OutputStream">
 /// The TextWriter to which the databases' key/data pairs are written.
 /// If null, <see cref="Console.Out"/> is used.
 /// </param>
 public static void Salvage(string file, DatabaseConfig cfg,
     bool Printable, bool Aggressive, TextWriter OutputStream)
 {
     using (Database db = new Database(cfg.Env, 0)) {
         db.Config(cfg);
         if (OutputStream == null)
             OutputStream = Console.Out;
         uint flags = DbConstants.DB_SALVAGE;
         flags |= Aggressive ? DbConstants.DB_AGGRESSIVE : 0;
         flags |= Printable ? DbConstants.DB_PRINTABLE : 0;
         writeToFileRef = new BDB_FileWriteDelegate(writeToFile);
         db.db.verify(file, null, OutputStream, writeToFileRef, flags);
     }
 }
开发者ID:simonzhangsm,项目名称:h-store,代码行数:43,代码来源:Database.cs


示例9: RmDBWithoutTxn

        public void RmDBWithoutTxn(string home, string dbName,
		    bool ifAutoCommit)
        {
            string dbFileName = dbName + ".db";
            string dbName1 = dbName + "1";
            string dbName2 = dbName + "2";

            // Open environment.
            DatabaseEnvironmentConfig envConfig =
                new DatabaseEnvironmentConfig();
            envConfig.Create = true;
            envConfig.UseMPool = true;
            if (ifAutoCommit == true)
            {
                envConfig.AutoCommit = true;
                envConfig.UseTxns = true;
            }

            DatabaseEnvironment env = DatabaseEnvironment.Open(
                home, envConfig);

            // Create two databases in the environment.
            BTreeDatabaseConfig dbConfig =
                new BTreeDatabaseConfig();
            dbConfig.Creation = CreatePolicy.IF_NEEDED;
            dbConfig.Env = env;
            BTreeDatabase btreeDB1 = BTreeDatabase.Open(
                dbFileName, dbName1, dbConfig);
            btreeDB1.Close();
            BTreeDatabase btreeDB2 = BTreeDatabase.Open(
                dbFileName, dbName2, dbConfig);
            btreeDB2.Close();

            // Remove one database from the environment.
            env.RemoveDB(dbFileName, dbName2, false);

            // Try to open the existing database.
            DatabaseConfig cfg = new DatabaseConfig();
            cfg.Env = env;
            Database db1 = Database.Open(dbFileName, dbName1, cfg);
            db1.Close();

            /*
             * Attempting to open the removed database should
             * cause error.
             */
            try
            {
                Database db2 = Database.Open(
                    dbFileName, dbName2, cfg);
                db2.Close();
            }
            catch (DatabaseException)
            {
                throw new ExpectedTestException();
            }
            finally
            {
                env.Close();
            }
        }
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:61,代码来源:DatabaseEnvironmentTest.cs


示例10: TestRemoveDBWithinTxn

        public void TestRemoveDBWithinTxn()
        {
            testName = "TestRemoveDBWithinTxn";
            SetUpTest(true);
            string dbFileName = testName + ".db";
            string dbName1 = testName + "1";
            string dbName2 = testName + "2";

            // Open environment.
            DatabaseEnvironmentConfig envConfig =
                new DatabaseEnvironmentConfig();
            envConfig.Create = true;
            envConfig.UseMPool = true;
            envConfig.UseTxns = true;
            envConfig.UseLogging = true;
            DatabaseEnvironment env = DatabaseEnvironment.Open(
                testHome, envConfig);
            Transaction txn = env.BeginTransaction();

            // Create two databases in the environment.
            BTreeDatabaseConfig dbConfig =
                new BTreeDatabaseConfig();
            dbConfig.Creation = CreatePolicy.IF_NEEDED;
            dbConfig.Env = env;
            BTreeDatabase btreeDB1 = BTreeDatabase.Open(
                dbFileName, dbName1, dbConfig, txn);
            btreeDB1.Close();
            BTreeDatabase btreeDB2 = BTreeDatabase.Open(
                dbFileName, dbName2, dbConfig, txn);
            btreeDB2.Close();

            // Remove one database from the environment.
            env.RemoveDB(dbFileName, dbName2, false, txn);

            // Try to open the existing database.
            DatabaseConfig cfg = new DatabaseConfig();
            cfg.Env = env;
            Database db1 = Database.Open(dbFileName, dbName1, cfg, txn);
            db1.Close();

            /*
             * Attempting to open the removed database should
             * cause error.
             */
            try
            {
                Database db2 = Database.Open(
                    dbFileName, dbName2, cfg, txn);
                db2.Close();
            }
            catch (DatabaseException)
            {
                throw new ExpectedTestException();
            }
            finally
            {
                txn.Commit();
                env.Close();
            }
        }
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:60,代码来源:DatabaseEnvironmentTest.cs


示例11: TestOpenExistingQueueDB

        public void TestOpenExistingQueueDB()
        {
            testName = "TestOpenExistingQueueDB";
            SetUpTest(true);
            string queueDBFileName = testHome + "/" + testName + ".db";

            QueueDatabaseConfig queueConfig = new QueueDatabaseConfig();
            queueConfig.Creation = CreatePolicy.ALWAYS;
            QueueDatabase queueDB = QueueDatabase.Open(
                queueDBFileName, queueConfig);
            queueDB.Close();

            DatabaseConfig dbConfig = new DatabaseConfig();
            Database db = Database.Open(queueDBFileName, dbConfig);
            Assert.AreEqual(db.Type, DatabaseType.QUEUE);
            db.Close();
        }
开发者ID:simonzhangsm,项目名称:h-store,代码行数:17,代码来源:QueueDatabaseTest.cs


示例12: TestOpenExistingHashDB

        public void TestOpenExistingHashDB()
        {
            testName = "TestOpenExistingHashDB";
            testHome = testFixtureHome + "/" + testName;
            string dbFileName = testHome + "/" + testName + ".db";

            Configuration.ClearDir(testHome);

            HashDatabaseConfig hashConfig =
                new HashDatabaseConfig();
            hashConfig.Creation = CreatePolicy.ALWAYS;
            HashDatabase hashDB = HashDatabase.Open(dbFileName, hashConfig);
            hashDB.Close();

            DatabaseConfig dbConfig = new DatabaseConfig();
            Database db = Database.Open(dbFileName, dbConfig);
            Assert.AreEqual(db.Type, DatabaseType.HASH);
            db.Close();
        }
开发者ID:gildafnai82,项目名称:craq,代码行数:19,代码来源:HashDatabaseTest.cs


示例13: ConfigEncryption

        public static bool ConfigEncryption(XmlElement xmlElem,
		    string name, DatabaseConfig dbConfig, bool compulsory)
        {
            EncryptionAlgorithm alg;
            XmlNode xmlNode;
            string tmp, password;

            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == false)
                return false;
            else if (xmlNode == null && compulsory == true)
                throw new ConfigNotFoundException(name);

            password = XMLReader.GetNode((XmlElement)xmlNode,
                "password").InnerText;
            tmp = XMLReader.GetNode((XmlElement)xmlNode, "algorithm").InnerText;
            if (tmp == "AES")
                alg = EncryptionAlgorithm.AES;
            else
                alg = EncryptionAlgorithm.DEFAULT;
            dbConfig.SetEncryption(password, alg);
            return true;
        }
开发者ID:mania25,项目名称:diy-project,代码行数:23,代码来源:Configuration.cs


示例14: TestOpenExistingBtreeDB

        public void TestOpenExistingBtreeDB()
        {
            testName = "TestOpenExistingBtreeDB";
            testHome = testFixtureHome + "/" + testName;
            string btreeDBFileName = testHome + "/" +
                 testName + ".db";

            Configuration.ClearDir(testHome);

            BTreeDatabaseConfig btreeConfig =
                new BTreeDatabaseConfig();
            btreeConfig.Creation = CreatePolicy.ALWAYS;
            BTreeDatabase btreeDB = BTreeDatabase.Open(
                btreeDBFileName, btreeConfig);
            btreeDB.Close();

            DatabaseConfig dbConfig = new DatabaseConfig();
            Database db = Database.Open(btreeDBFileName,
                dbConfig);
            Assert.AreEqual(db.Type, DatabaseType.BTREE);
            Assert.AreEqual(db.Creation, CreatePolicy.NEVER);
            db.Close();
        }
开发者ID:remotesyssupport,项目名称:omnibus,代码行数:23,代码来源:BTreeDatabaseTest.cs


示例15: TestOpenMulDBInSingleFile

        public void TestOpenMulDBInSingleFile()
        {
            testName = "TestOpenMulDBInSingleFile";
            testHome = testFixtureHome + "/" + testName;
            string btreeDBFileName = testHome + "/" +
                testName + ".db";
            string[] btreeDBArr = new string[4];

            for (int i = 0; i < 4; i++)
                btreeDBArr[i] = Path.GetFileNameWithoutExtension(
                    btreeDBFileName) + i;

            Configuration.ClearDir(testHome);

            BTreeDatabaseConfig btreeDBConfig =
                new BTreeDatabaseConfig();
            btreeDBConfig.Creation = CreatePolicy.IF_NEEDED;

            BTreeDatabase btreeDB;
            for (int i = 0; i < 4; i++)
            {
                btreeDB = BTreeDatabase.Open(btreeDBFileName,
                    btreeDBArr[i], btreeDBConfig);
                Assert.AreEqual(CreatePolicy.IF_NEEDED, btreeDB.Creation);
                btreeDB.Close();
            }

            DatabaseConfig dbConfig = new DatabaseConfig();
            Database db;
            for (int i = 0; i < 4; i++)
            {
                using (db = Database.Open(btreeDBFileName,
                    btreeDBArr[i], dbConfig))
                {
                    Assert.AreEqual(btreeDBArr[i],
                        db.DatabaseName);
                    Assert.AreEqual(DatabaseType.BTREE,
                        db.Type);
                }
            }
        }
开发者ID:remotesyssupport,项目名称:omnibus,代码行数:41,代码来源:BTreeDatabaseTest.cs


示例16: Open

 /// <summary>
 /// Protected factory method to create and open a new database object.
 /// </summary>
 /// <param name="Filename">The database's filename</param>
 /// <param name="DatabaseName">The subdatabase's name</param>
 /// <param name="cfg">The database's configuration</param>
 /// <param name="txn">
 /// The transaction in which to open the database
 /// </param>
 /// <returns>A new, open database object</returns>
 protected static BaseDatabase Open(string Filename,
     string DatabaseName, DatabaseConfig cfg, Transaction txn)
 {
     BaseDatabase ret = new BaseDatabase(cfg.Env, 0);
     ret.Config(cfg);
     ret.db.open(Transaction.getDB_TXN(txn),
         Filename, DatabaseName, DBTYPE.DB_UNKNOWN, cfg.openFlags, 0);
     return ret;
 }
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:19,代码来源:BaseDatabase.cs


示例17: TestOpenExistingHeapDB

        public void TestOpenExistingHeapDB()
        {
            testName = "TestOpenExistingHeapDB";
            SetUpTest(true);
            string heapDBFileName = testHome + "/" + testName + ".db";

            HeapDatabaseConfig heapConfig = new HeapDatabaseConfig();
            heapConfig.Creation = CreatePolicy.ALWAYS;
            HeapDatabase heapDB = HeapDatabase.Open(
                heapDBFileName, heapConfig);
            heapDB.Close();

            DatabaseConfig dbConfig = new DatabaseConfig();
            Database db = Database.Open(heapDBFileName, dbConfig);
            Assert.AreEqual(db.Type, DatabaseType.HEAP);
            db.Close();
        }
开发者ID:bohrasd,项目名称:windowsrtdev,代码行数:17,代码来源:HeapDatabaseTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# BerkeleyDB.DatabaseEntry类代码示例发布时间:2022-05-24
下一篇:
C# BerkeleyDB.CursorConfig类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap