Пример #1
0
        private void Config(BTreeDatabaseConfig cfg) {
            base.Config(cfg);
            /* 
             * Database.Config calls set_flags, but that does not get the BTree
             * specific flags.  No harm in calling it again.
             */
            db.set_flags(cfg.flags);

            if (cfg.BlobDir != null && cfg.Env == null)
                db.set_blob_dir(cfg.BlobDir);

            if (cfg.blobThresholdIsSet)
                db.set_blob_threshold(cfg.BlobThreshold, 0);

            if (cfg.BTreeCompare != null)
                Compare = cfg.BTreeCompare;

            if (cfg.BTreePrefixCompare != null)
                PrefixCompare = cfg.BTreePrefixCompare;

            // The duplicate comparison function cannot change.
            if (cfg.DuplicateCompare != null)
                DupCompare = cfg.DuplicateCompare;

            if (cfg.minkeysIsSet)
                db.set_bt_minkey(cfg.MinKeysPerPage);
                
            if (cfg.compressionIsSet) {
                Compress = cfg.Compress;
                Decompress = cfg.Decompress;
                if (Compress == null)
                    doCompressRef = null;
                else
                    doCompressRef = new BDB_CompressDelegate(doCompress);
                if (Decompress == null)
                    doDecompressRef = null;
                else
                    doDecompressRef = new BDB_DecompressDelegate(doDecompress);
                db.set_bt_compress(doCompressRef, doDecompressRef);
            }

            if (cfg.partitionIsSet) {
                nparts = cfg.NParts;
                Partition = cfg.Partition;
                if (Partition == null)
                    doPartitionRef = null;
                else
                    doPartitionRef = new BDB_PartitionDelegate(doPartition);
                partitionKeys = cfg.PartitionKeys;
                IntPtr[] ptrs = null;
                if (partitionKeys != null) {
                    int size = (int)nparts - 1;
                    ptrs = new IntPtr[size];
                    for (int i = 0; i < size; i++)
                        ptrs[i] = DBT.getCPtr(
                            DatabaseEntry.getDBT(partitionKeys[i])).Handle;
                }
                db.set_partition(nparts, ptrs, doPartitionRef);
            }
        }
Пример #2
0
        private void Config(BTreeDatabaseConfig cfg) {
            base.Config(cfg);
            /* 
             * Database.Config calls set_flags, but that doesn't get the BTree
             * specific flags.  No harm in calling it again.
             */
            db.set_flags(cfg.flags);
            
            if (cfg.BTreeCompare != null)
                Compare = cfg.BTreeCompare;

            if (cfg.BTreePrefixCompare != null)
                PrefixCompare = cfg.BTreePrefixCompare;

            // The duplicate comparison function cannot change.
            if (cfg.DuplicateCompare != null)
                DupCompare = cfg.DuplicateCompare;

            if (cfg.minkeysIsSet)
                db.set_bt_minkey(cfg.MinKeysPerPage);
                
            if (cfg.compressionIsSet) {
                Compress = cfg.Compress;
                Decompress = cfg.Decompress;
                if (Compress == null)
                    doCompressRef = null;
                else
                    doCompressRef = new BDB_CompressDelegate(doCompress);
                if (Decompress == null)
                    doDecompressRef = null;
                else
                    doDecompressRef = new BDB_DecompressDelegate(doDecompress);
                db.set_bt_compress(doCompressRef, doDecompressRef);
            }
        }
Пример #3
0
        internal int set_bt_compress(BDB_CompressDelegate compress, BDB_DecompressDelegate decompress)
        {
            int ret;

            ret = libdb_csharpPINVOKE.DB_set_bt_compress(swigCPtr, compress, decompress);
            DatabaseException.ThrowException(ret);
            return(ret);
        }
Пример #4
0
        private void Config(BTreeDatabaseConfig cfg)
        {
            base.Config(cfg);

            /*
             * Database.Config calls set_flags, but that doesn't get the BTree
             * specific flags.  No harm in calling it again.
             */
            db.set_flags(cfg.flags);

            if (cfg.BTreeCompare != null)
            {
                Compare = cfg.BTreeCompare;
            }

            if (cfg.BTreePrefixCompare != null)
            {
                PrefixCompare = cfg.BTreePrefixCompare;
            }

            // The duplicate comparison function cannot change.
            if (cfg.DuplicateCompare != null)
            {
                DupCompare = cfg.DuplicateCompare;
            }

            if (cfg.minkeysIsSet)
            {
                db.set_bt_minkey(cfg.MinKeysPerPage);
            }

            if (cfg.compressionIsSet)
            {
                Compress   = cfg.Compress;
                Decompress = cfg.Decompress;
                if (Compress == null)
                {
                    doCompressRef = null;
                }
                else
                {
                    doCompressRef = new BDB_CompressDelegate(doCompress);
                }
                if (Decompress == null)
                {
                    doDecompressRef = null;
                }
                else
                {
                    doDecompressRef = new BDB_DecompressDelegate(doDecompress);
                }
                db.set_bt_compress(doCompressRef, doDecompressRef);
            }
        }
Пример #5
0
Файл: DB.cs Проект: mcandre/db
 internal int set_bt_compress(BDB_CompressDelegate compress, BDB_DecompressDelegate decompress)
 {
     int ret;
     ret = libdb_csharpPINVOKE.DB_set_bt_compress(swigCPtr, compress, decompress);
     DatabaseException.ThrowException(ret);
     return ret;
 }
Пример #6
0
        private void Config(BTreeDatabaseConfig cfg)
        {
            base.Config(cfg);

            /*
             * Database.Config calls set_flags, but that does not get the BTree
             * specific flags.  No harm in calling it again.
             */
            db.set_flags(cfg.flags);

            if (cfg.BlobDir != null && cfg.Env == null)
            {
                db.set_ext_file_dir(cfg.BlobDir);
            }

            if (cfg.ExternalFileDir != null && cfg.Env == null)
            {
                db.set_ext_file_dir(cfg.ExternalFileDir);
            }

            if (cfg.blobThresholdIsSet)
            {
                db.set_ext_file_threshold(cfg.BlobThreshold, 0);
            }

            if (cfg.BTreeCompare != null)
            {
                Compare = cfg.BTreeCompare;
            }

            if (cfg.BTreePrefixCompare != null)
            {
                PrefixCompare = cfg.BTreePrefixCompare;
            }

            // The duplicate comparison function cannot change.
            if (cfg.DuplicateCompare != null)
            {
                DupCompare = cfg.DuplicateCompare;
            }

            if (cfg.minkeysIsSet)
            {
                db.set_bt_minkey(cfg.MinKeysPerPage);
            }

            if (cfg.compressionIsSet)
            {
                Compress   = cfg.Compress;
                Decompress = cfg.Decompress;
                if (Compress == null)
                {
                    doCompressRef = null;
                }
                else
                {
                    doCompressRef = new BDB_CompressDelegate(doCompress);
                }
                if (Decompress == null)
                {
                    doDecompressRef = null;
                }
                else
                {
                    doDecompressRef = new BDB_DecompressDelegate(doDecompress);
                }
                db.set_bt_compress(doCompressRef, doDecompressRef);
            }

            if (cfg.partitionIsSet)
            {
                nparts    = cfg.NParts;
                Partition = cfg.Partition;
                if (Partition == null)
                {
                    doPartitionRef = null;
                }
                else
                {
                    doPartitionRef = new BDB_PartitionDelegate(doPartition);
                }
                partitionKeys = cfg.PartitionKeys;
                IntPtr[] ptrs = null;
                if (partitionKeys != null)
                {
                    int size = (int)nparts - 1;
                    ptrs = new IntPtr[size];
                    for (int i = 0; i < size; i++)
                    {
                        ptrs[i] = DBT.getCPtr(
                            DatabaseEntry.getDBT(partitionKeys[i])).Handle;
                    }
                }
                db.set_partition(nparts, ptrs, doPartitionRef);
            }
        }
Пример #7
0
 public static extern int DB_set_bt_compress(HandleRef jarg1, BDB_CompressDelegate jarg2, BDB_DecompressDelegate jarg3);