Beispiel #1
0
 public static void MemMove(Mem to, Mem from)
 {
     Debug.Assert(from.Ctx == null || MutexEx.Held(from.Ctx.Mutex));
     Debug.Assert(to.Ctx == null || MutexEx.Held(to.Ctx.Mutex));
     Debug.Assert(from.Ctx == null || to.Ctx == null || from.Ctx == to.Ctx);
     MemRelease(to);
     from._memcpy(ref to);
     from.Flags = MEM.Null;
     from.Del   = null;
     from.Z     = null;
     from.Z_    = null;
 }
Beispiel #2
0
 //: #define MEMCELLSIZE (size_t)(&(((Mem *)0)->Malloc)) // Size of struct Mem not including the Mem.zMalloc member.
 public static void MemShallowCopy(Mem to, Mem from, MEM srcType)
 {
     Debug.Assert((from.Flags & MEM.RowSet) == 0);
     MemReleaseExternal(to);
     from._memcpy(ref to);
     to.Del = null;
     if ((from.Flags & MEM.Static) != 0)
     {
         to.Flags &= ~(MEM.Dyn | MEM.Static | MEM.Ephem);
         Debug.Assert(srcType == MEM.Ephem || srcType == MEM.Static);
         to.Flags |= srcType;
     }
 }
Beispiel #3
0
        public static RC MemCopy(Mem to, Mem from)
        {
            Debug.Assert((from.Flags & MEM.RowSet) == 0);
            E.VdbeMemRelease(to);
            from._memcpy(ref to);
            to.Flags &= ~MEM.Dyn;
            RC rc = RC.OK;

            if ((to.Flags & (MEM.Str | MEM.Blob)) != 0)
            {
                if ((from.Flags & MEM.Static) == 0)
                {
                    to.Flags |= MEM.Ephem;
                    rc        = MemMakeWriteable(to);
                }
            }
            return(rc);
        }