/// <summary> /// Instantiate a new HashDatabaseConfig object /// </summary> public HashDatabaseConfig() { Duplicates = DuplicatesPolicy.NONE; HashComparison = null; fillFactorIsSet = false; nelemIsSet = false; Creation = CreatePolicy.NEVER; }
/// <summary> /// Instantiate a new SecondaryHashDatabaseConfig object /// </summary> public SecondaryHashDatabaseConfig( Database PrimaryDB, SecondaryKeyGenDelegate KeyGenFunc) : base(PrimaryDB, KeyGenFunc) { Duplicates = DuplicatesPolicy.NONE; Compare = null; fillFactorIsSet = false; nelemIsSet = false; DbType = DatabaseType.HASH; }
public void TestCompare() { testName = "TestCompare"; SetUpTest(true); string dbFileName = testHome + "/" + testName + ".db"; // Open a primary btree database. BTreeDatabaseConfig btreeDBConfig = new BTreeDatabaseConfig(); btreeDBConfig.Creation = CreatePolicy.ALWAYS; BTreeDatabase btreeDB = BTreeDatabase.Open( dbFileName, btreeDBConfig); // Open a secondary btree database. SecondaryBTreeDatabaseConfig secBtreeDBConfig = new SecondaryBTreeDatabaseConfig(null, null); secBtreeDBConfig.Primary = btreeDB; secBtreeDBConfig.Compare = new EntryComparisonDelegate( SecondaryEntryComparison); secBtreeDBConfig.KeyGen = new SecondaryKeyGenDelegate(SecondaryKeyGen); SecondaryBTreeDatabase secDB = SecondaryBTreeDatabase.Open( dbFileName, secBtreeDBConfig); /* * Get the compare function set in the configuration * and run it in a comparison to see if it is alright. */ EntryComparisonDelegate cmp = secDB.Compare; DatabaseEntry dbt1, dbt2; dbt1 = new DatabaseEntry( BitConverter.GetBytes((int)257)); dbt2 = new DatabaseEntry( BitConverter.GetBytes((int)255)); Assert.Less(0, cmp(dbt1, dbt2)); for (int i = 0; i < 1000; i++) { btreeDB.Put(new DatabaseEntry( BitConverter.GetBytes(i)), new DatabaseEntry( BitConverter.GetBytes(i))); } secDB.Close(); btreeDB.Close(); }
public void TestPrefixCompare() { testName = "TestPrefixCompare"; testHome = testFixtureHome + "/" + testName; string dbFileName = testHome + "/" + testName + ".db"; Configuration.ClearDir(testHome); // Open a primary btree database. BTreeDatabaseConfig btreeDBConfig = new BTreeDatabaseConfig(); btreeDBConfig.Creation = CreatePolicy.ALWAYS; BTreeDatabase btreeDB = BTreeDatabase.Open( dbFileName, btreeDBConfig); // Open a secondary btree database. SecondaryBTreeDatabaseConfig secBtreeDBConfig = new SecondaryBTreeDatabaseConfig(btreeDB, null); secBtreeDBConfig.Primary = btreeDB; secBtreeDBConfig.Compare = new EntryComparisonDelegate( SecondaryEntryComparison); secBtreeDBConfig.PrefixCompare = new EntryComparisonDelegate( SecondaryEntryComparison); secBtreeDBConfig.KeyGen = new SecondaryKeyGenDelegate( SecondaryKeyGen); SecondaryBTreeDatabase secDB = SecondaryBTreeDatabase.Open( dbFileName, secBtreeDBConfig); /* * Get the prefix compare function set in the * configuration and run it in a comparison to * see if it is alright. */ EntryComparisonDelegate cmp = secDB.PrefixCompare; DatabaseEntry dbt1, dbt2; dbt1 = new DatabaseEntry( BitConverter.GetBytes((int)1)); dbt2 = new DatabaseEntry( BitConverter.GetBytes((int)129)); Assert.Greater(0, cmp(dbt1, dbt2)); secDB.Close(); btreeDB.Close(); }
/// <summary> /// Create a new BTreeDatabaseConfig object /// </summary> public BTreeDatabaseConfig() { Duplicates = DuplicatesPolicy.NONE; NoReverseSplitting = false; UseRecordNumbers = false; BTreeCompare = null; BTreePrefixCompare = null; minkeysIsSet = false; Creation = CreatePolicy.NEVER; }
/// <summary> /// Create a new SecondaryBTreeDatabaseConfig object /// </summary> public SecondaryBTreeDatabaseConfig( Database PrimaryDB, SecondaryKeyGenDelegate KeyGenFunc) : base(PrimaryDB, KeyGenFunc) { Duplicates = DuplicatesPolicy.NONE; NoReverseSplitting = false; UseRecordNumbers = false; Compare = null; PrefixCompare = null; minkeysIsSet = false; DbType = DatabaseType.BTREE; }
/// <summary> /// Create a new BTreeDatabaseConfig object /// </summary> public BTreeDatabaseConfig() { Duplicates = DuplicatesPolicy.NONE; NoReverseSplitting = false; UseRecordNumbers = false; BTreeCompare = null; BTreePrefixCompare = null; minkeysIsSet = false; Creation = CreatePolicy.NEVER; }
/// <summary> /// Instantiate a new HashDatabaseConfig object /// </summary> public HashDatabaseConfig() { blobThresholdIsSet = false; Duplicates = DuplicatesPolicy.NONE; HashComparison = null; fillFactorIsSet = false; nelemIsSet = false; Creation = CreatePolicy.NEVER; }
/// <summary> /// Instantiate a new SecondaryHashDatabaseConfig object /// </summary> public SecondaryHashDatabaseConfig( Database PrimaryDB, SecondaryKeyGenDelegate KeyGenFunc) : base(PrimaryDB, KeyGenFunc) { Duplicates = DuplicatesPolicy.NONE; Compare = null; fillFactorIsSet = false; nelemIsSet = false; DbType = DatabaseType.HASH; }
/// <summary> /// Create a new SecondaryBTreeDatabaseConfig object /// </summary> public SecondaryBTreeDatabaseConfig( Database PrimaryDB, SecondaryKeyGenDelegate KeyGenFunc) : base(PrimaryDB, KeyGenFunc) { Duplicates = DuplicatesPolicy.NONE; NoReverseSplitting = false; UseRecordNumbers = false; Compare = null; PrefixCompare = null; minkeysIsSet = false; DbType = DatabaseType.BTREE; }