Exemple #1
0
        public SequenceStats GetStats(StatFlags flags)
        {
            SequenceStats     value;
            DB_SEQUENCE_STAT *sp;

            lock (rscLock) {
                DB_SEQUENCE *seqp = CheckDisposed();
                RuntimeHelpers.PrepareConstrainedRegions();
                try { }
                finally {
                    DbRetVal ret = seqp->Stat(seqp, out sp, unchecked ((UInt32)flags));
                    Util.CheckRetVal(ret);
                    value.seqStats = *sp;
                    LibDb.os_ufree(null, sp);
                }
            }
            return(value);
        }
Exemple #2
0
        public static void BufferToPtr(byte[] buffer, int start, int length, ref byte *ptr)
        {
            void *mem = ptr;

            // we pass null for the environment, as we don't want error call-backs
            // DbRetVal ret = LibDb.ReallocMem(null, (uint)length, ref mem);  // not exported
            if (ptr != null)
            {
                LibDb.os_ufree(null, mem);
            }
            DbRetVal ret;

            RuntimeHelpers.PrepareConstrainedRegions();
            try { }
            finally {
                ret = LibDb.os_umalloc(null, (uint)length, out mem);
                if (ret == DbRetVal.SUCCESS)
                {
                    ptr = (byte *)mem;
                }
            }
            Util.CheckRetVal(ret);
            Marshal.Copy(buffer, start, (IntPtr)ptr, length);
        }