Пример #1
0
        // does not check if disposed
        internal static Db GetDb(DB_SEQUENCE *seqp)
        {
            // DB* dbp;
            // DbRetVal ret = seqp->GetDb(seqp, out dbp);
            // Util.CheckRetVal(ret);
            // workaround for bug in GetDb - does not return dbp when sequence not open
            DB *dbp = seqp->seq_dbp;
            Db  db  = Util.GetDb(dbp);

            return(db);
        }
Пример #2
0
        // should be run in a CER, under a lock on rscLock, and not throw exceptions
        internal DbRetVal AllocateHandle(DB *dbp, UInt32 flags)
        {
            DbRetVal ret;

            lock (rscLock) {
                DB_SEQUENCE *seqp;
                ret = LibDb.db_sequence_create(out seqp, dbp, flags);
                if (ret == DbRetVal.SUCCESS)
                {
                    this.seqp          = seqp;
                    seqp->api_internal = (IntPtr)instanceHandle;
                }
            }
            return(ret);
        }
Пример #3
0
 public static Db GetDb(DB *dbp)
 {
     if (dbp == null)
     {
         return(null);
     }
     else
     {
         IntPtr gh = dbp->api_internal;
         if (gh == IntPtr.Zero)
         {
             return(null);
         }
         else
         {
             return((Db)((GCHandle)gh).Target);
         }
     }
 }