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


C# Internal.DBT类代码示例

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


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

示例1: doRepTransport

 private static int doRepTransport(IntPtr envp,
     IntPtr controlp, IntPtr recp, IntPtr lsnp, int envid, uint flags) {
     DB_ENV dbenv = new DB_ENV(envp, false);
     DBT control = new DBT(controlp, false);
     DBT rec = new DBT(recp, false);
     DB_LSN tmplsn = new DB_LSN(lsnp, false);
     LSN dblsn = new LSN(tmplsn.file, tmplsn.offset);
     return dbenv.api2_internal.transportHandler(
         DatabaseEntry.fromDBT(control),
         DatabaseEntry.fromDBT(rec), dblsn, envid, flags);
 }
开发者ID:gildafnai82,项目名称:craq,代码行数:11,代码来源:DatabaseEnvironment.cs

示例2: doDupCompare

        private static int doDupCompare(
            IntPtr dbp, IntPtr dbt1p, IntPtr dbt2p)
        {
            DB db = new DB(dbp, false);
            DBT dbt1 = new DBT(dbt1p, false);
            DBT dbt2 = new DBT(dbt2p, false);

            BTreeDatabase btdb = (BTreeDatabase)(db.api_internal);
            return btdb.DupCompare(
                DatabaseEntry.fromDBT(dbt1), DatabaseEntry.fromDBT(dbt2));
        }
开发者ID:mcandre,项目名称:db,代码行数:11,代码来源:BTreeDatabase.cs

示例3: doDecompress

 private static int doDecompress(IntPtr dbp, IntPtr prevKeyp,
     IntPtr prevDatap, IntPtr cmpp, IntPtr destKeyp, IntPtr destDatap)
 {
     DB db = new DB(dbp, false);
     DatabaseEntry prevKey =
         DatabaseEntry.fromDBT(new DBT(prevKeyp, false));
     DatabaseEntry prevData =
         DatabaseEntry.fromDBT(new DBT(prevDatap, false));
     DBT compressed = new DBT(cmpp, false);
     DBT destKey = new DBT(destKeyp, false);
     DBT destData = new DBT(destDatap, false);
     BTreeDatabase btdb = (BTreeDatabase)(db.api_internal);
     uint size;
     try {
         KeyValuePair<DatabaseEntry, DatabaseEntry> kvp = btdb.Decompress(prevKey, prevData, compressed.data, out size);
         int keylen = kvp.Key.Data.Length;
         int datalen = kvp.Value.Data.Length;
         destKey.size = (uint)keylen;
         destData.size = (uint)datalen;
         if (keylen > destKey.ulen ||
             datalen > destData.ulen)
             return DbConstants.DB_BUFFER_SMALL;
         Marshal.Copy(kvp.Key.Data, 0, destKey.dataPtr, keylen);
         Marshal.Copy(kvp.Value.Data, 0, destData.dataPtr, datalen);
         compressed.size = size;
         return 0;
     } catch (Exception) {
         return -1;
     }
 }
开发者ID:mcandre,项目名称:db,代码行数:30,代码来源:BTreeDatabase.cs

示例4: doCompress

 private static int doCompress(IntPtr dbp, IntPtr prevKeyp,
     IntPtr prevDatap, IntPtr keyp, IntPtr datap, IntPtr destp)
 {
     DB db = new DB(dbp, false);
     DatabaseEntry prevKey =
         DatabaseEntry.fromDBT(new DBT(prevKeyp, false));
     DatabaseEntry prevData =
         DatabaseEntry.fromDBT(new DBT(prevDatap, false));
     DatabaseEntry key = DatabaseEntry.fromDBT(new DBT(keyp, false));
     DatabaseEntry data = DatabaseEntry.fromDBT(new DBT(datap, false));
     DBT dest = new DBT(destp, false);
     BTreeDatabase btdb = (BTreeDatabase)(db.api_internal);
     byte[] arr = new byte[(int)dest.ulen];
     int len;
     try {
         if (btdb.Compress(prevKey, prevData, key, data, ref arr, out len)) {
             Marshal.Copy(arr, 0, dest.dataPtr, len);
             dest.size = (uint)len;
             return 0;
         } else {
             return DbConstants.DB_BUFFER_SMALL;
         }
     } catch (Exception) {
         return -1;
     }
 }
开发者ID:mcandre,项目名称:db,代码行数:26,代码来源:BTreeDatabase.cs

示例5: doPrefixCompare

 private static uint doPrefixCompare(
     IntPtr dbp, IntPtr dbtp1, IntPtr dbtp2)
 {
     DB db = new DB(dbp, false);
     DBT dbt1 = new DBT(dbtp1, false);
     DBT dbt2 = new DBT(dbtp2, false);
     BTreeDatabase btdb = (BTreeDatabase)(db.api_internal);
     return btdb.PrefixCompare(
         DatabaseEntry.fromDBT(dbt1), DatabaseEntry.fromDBT(dbt2));
 }
开发者ID:mcandre,项目名称:db,代码行数:10,代码来源:BTreeDatabase.cs

示例6: lock_get

 internal DB_LOCK lock_get(uint locker, uint flags, DBT arg2, db_lockmode_t mode)
 {
     int err = 0;
     DB_LOCK ret = lock_get(locker, flags, DatabaseEntry.fromDBT(arg2), mode, ref err);
     DatabaseException.ThrowException(err);
     return ret;
 }
开发者ID:mania25,项目名称:diy-project,代码行数:7,代码来源:DB_ENV.cs

示例7: doAssociate

        /// <summary>
        /// Protected method to call the key generation function.
        /// </summary>
        /// <param name="dbp">Secondary DB Handle</param>
        /// <param name="keyp">Primary Key</param>
        /// <param name="datap">Primary Data</param>
        /// <param name="skeyp">Scondary Key</param>
        /// <returns>0 on success, !0 on failure</returns>
        protected static int doAssociate(
            IntPtr dbp, IntPtr keyp, IntPtr datap, IntPtr skeyp) {
            DB db = new DB(dbp, false);
            DBT key = new DBT(keyp, false);
            DBT data = new DBT(datap, false);
            DBT skey = new DBT(skeyp, false);
            IntPtr dataPtr, sdataPtr;
            int nrecs, dbt_sz;

            DatabaseEntry s =
                ((SecondaryDatabase)db.api_internal).KeyGen(
                DatabaseEntry.fromDBT(key), DatabaseEntry.fromDBT(data));

            if (s == null)
                return DbConstants.DB_DONOTINDEX;
            if (s is MultipleDatabaseEntry) {
                MultipleDatabaseEntry mde = (MultipleDatabaseEntry)s;
                nrecs = mde.nRecs;
                /* 
                 * Allocate an array of nrecs DBT in native memory.  The call 
                 * returns sizeof(DBT), so that we know where one DBT ends and 
                 * the next begins.
                 */
                dbt_sz = (int)libdb_csharp.alloc_dbt_arr(null, nrecs, out sdataPtr);
                /* 
                 * We need a managed array to copy each DBT into and then we'll
                 * copy the managed array to the native array we just allocated.
                 * We are not able to copy native -> native.
                 */
                byte[] arr = new byte[nrecs * dbt_sz];
                IntPtr p;
                int off = 0;
                /* Copy each DBT into the array. */
                foreach (DatabaseEntry dbt in mde) {
                    /* Allocate room for the data in native memory. */
                    dataPtr = libdb_csharp.__os_umalloc(null, dbt.size);
                    Marshal.Copy(dbt.Data, 0, dataPtr, (int)dbt.size);
                    dbt.dbt.dataPtr = dataPtr;
                    dbt.flags |= DbConstants.DB_DBT_APPMALLOC;

                    p = DBT.getCPtr(DatabaseEntry.getDBT(dbt)).Handle;
                    Marshal.Copy(p, arr, off, dbt_sz);
                    off += dbt_sz;
                }
                Marshal.Copy(arr, 0, sdataPtr, nrecs * dbt_sz);
                skey.dataPtr = sdataPtr;
                skey.size = (uint)mde.nRecs;
                skey.flags = DbConstants.DB_DBT_MULTIPLE | DbConstants.DB_DBT_APPMALLOC;
            } else
                skey.data = s.Data;
            return 0;
        }
开发者ID:rohitlodha,项目名称:DenverDB,代码行数:60,代码来源:SecondaryDatabase.cs

示例8: doPrefixCompare

 private static uint doPrefixCompare(
     IntPtr dbp, IntPtr dbtp1, IntPtr dbtp2)
 {
     DB db = new DB(dbp, false);
     DBT dbt1 = new DBT(dbtp1, false);
     DBT dbt2 = new DBT(dbtp2, false);
     SecondaryBTreeDatabase tmp =
                     (SecondaryBTreeDatabase)db.api_internal;
     return tmp.prefixCompareHandler(
         DatabaseEntry.fromDBT(dbt1), DatabaseEntry.fromDBT(dbt2));
 }
开发者ID:hyc,项目名称:BerkeleyDB,代码行数:11,代码来源:SecondaryBTreeDatabase.cs

示例9: fromDBT

 internal static DatabaseEntry fromDBT(DBT dbt)
 {
     if (dbt.app_data != null)
         return dbt.app_data;
     else
         return new DatabaseEntry(dbt);
 }
开发者ID:mcandre,项目名称:db,代码行数:7,代码来源:DatabaseEntry.cs

示例10: dbt_usercopy

        /*
         * Copy between the C# byte array and the C library's void * as needed.
         * The library will call this method when it needs data from us or has
         * data to give us.  This prevents us from needing to copy all data in
         * and all data out.  The callback to this method gets set when the
         * DatabaseEnvironment is created (or the Database if created w/o an
         * environment.)
         */
        internal static int dbt_usercopy(IntPtr dbtp, uint offset, IntPtr buf, uint size, uint flags)
        {
            DBT dbt = new DBT(dbtp, false);
            DatabaseEntry ent = dbt.app_data;

            if (flags == DbConstants.DB_USERCOPY_GETDATA)
                Marshal.Copy(ent.Data, 0, buf, (int)size);
            else {
                /*
                 * If the offset is zero, we're writing a new buffer and can
                 * simply allocate byte array.  If the offset is not zero,
                 * however, we are appending to the exisiting array.  Since we
                 * can't extend it, we have to allocate a new one and copy.
                 *
                 * Our caller is setting dbt.size, so set ent._data directly,
                 * since ent.Data would overwrite dbt.size.
                 */
                if (offset != 0) {
                    byte[] t = new byte[ent.Data.Length + (int)size];
                    ent.Data.CopyTo(t, 0);
                    ent._data = t;
                } else
                    ent._data = new byte[(int)size];

                Marshal.Copy(buf, ent.Data, (int)offset, (int)size);
            }
            return 0;
        }
开发者ID:mcandre,项目名称:db,代码行数:36,代码来源:DatabaseEntry.cs

示例11: DatabaseEntry

 private DatabaseEntry(DBT dbtp)
 {
     dbt = dbtp;
     Data = (byte[])dbtp.data.Clone();
 }
开发者ID:mcandre,项目名称:db,代码行数:5,代码来源:DatabaseEntry.cs

示例12: doCompare

 private static int doCompare(IntPtr dbp, 
     IntPtr dbtp1, IntPtr dbtp2, IntPtr locp)
 {
     DB db = new DB(dbp, false);
     DBT dbt1 = new DBT(dbtp1, false);
     DBT dbt2 = new DBT(dbtp2, false);
     if (locp != IntPtr.Zero)
         locp = IntPtr.Zero;
     BTreeDatabase btdb = (BTreeDatabase)(db.api_internal);
     return btdb.Compare(
         DatabaseEntry.fromDBT(dbt1), DatabaseEntry.fromDBT(dbt2));
 }
开发者ID:xiaogao0371,项目名称:dockerfile,代码行数:12,代码来源:BTreeDatabase.cs

示例13: getCPtr

 internal static HandleRef getCPtr(DBT obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:4,代码来源:DBT.cs

示例14: doDupCompare

        private static int doDupCompare(
            IntPtr dbp, IntPtr dbt1p, IntPtr dbt2p)
        {
            DB db = new DB(dbp, false);
            DBT dbt1 = new DBT(dbt1p, false);
            DBT dbt2 = new DBT(dbt2p, false);

            SecondaryHashDatabase tmp = (SecondaryHashDatabase)db.api_internal;
            return tmp.DupCompare(
                DatabaseEntry.fromDBT(dbt1), DatabaseEntry.fromDBT(dbt2));
        }
开发者ID:balagopalraj,项目名称:clearlinux,代码行数:11,代码来源:SecondaryHashDatabase.cs

示例15: doCompare

 private static int doCompare(IntPtr dbp,
     IntPtr dbtp1, IntPtr dbtp2, IntPtr locp)
 {
     DB db = new DB(dbp, false);
     DBT dbt1 = new DBT(dbtp1, false);
     DBT dbt2 = new DBT(dbtp2, false);
     if (locp != IntPtr.Zero)
         locp = IntPtr.Zero;
     SecondaryBTreeDatabase tmp =
         (SecondaryBTreeDatabase)db.api_internal;
     return tmp.compareHandler(
         DatabaseEntry.fromDBT(dbt1), DatabaseEntry.fromDBT(dbt2));
 }
开发者ID:hyc,项目名称:BerkeleyDB,代码行数:13,代码来源:SecondaryBTreeDatabase.cs


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