예제 #1
0
        public ISQLiteChangeSet CombineWith(ISQLiteChangeSet changeSet)
        {
            ISQLiteChangeSet sQLiteMemoryChangeSets;

            this.CheckDisposed();
            SQLiteSessionHelpers.CheckRawData(this.rawData);
            SQLiteMemoryChangeSet sQLiteMemoryChangeSets1 = changeSet as SQLiteMemoryChangeSet;

            if (sQLiteMemoryChangeSets1 == null)
            {
                throw new ArgumentException("not a memory based change set", "changeSet");
            }
            SQLiteSessionHelpers.CheckRawData(sQLiteMemoryChangeSets1.rawData);
            IntPtr zero   = IntPtr.Zero;
            IntPtr intPtr = IntPtr.Zero;
            IntPtr zero1  = IntPtr.Zero;

            try
            {
                int num = 0;
                zero = SQLiteBytes.ToIntPtr(this.rawData, ref num);
                int num1 = 0;
                intPtr = SQLiteBytes.ToIntPtr(sQLiteMemoryChangeSets1.rawData, ref num1);
                int             num2            = 0;
                SQLiteErrorCode sQLiteErrorCode = UnsafeNativeMethods.sqlite3changeset_concat(num, zero, num1, intPtr, ref num2, ref zero1);
                if (sQLiteErrorCode != SQLiteErrorCode.Ok)
                {
                    throw new SQLiteException(sQLiteErrorCode, "sqlite3changeset_concat");
                }
                byte[] numArray = SQLiteBytes.FromIntPtr(zero1, num2);
                sQLiteMemoryChangeSets = new SQLiteMemoryChangeSet(numArray, base.GetHandle(), base.GetFlags());
            }
            finally
            {
                if (zero1 != IntPtr.Zero)
                {
                    SQLiteMemory.Free(zero1);
                    zero1 = IntPtr.Zero;
                }
                if (intPtr != IntPtr.Zero)
                {
                    SQLiteMemory.Free(intPtr);
                    intPtr = IntPtr.Zero;
                }
                if (zero != IntPtr.Zero)
                {
                    SQLiteMemory.Free(zero);
                    zero = IntPtr.Zero;
                }
            }
            return(sQLiteMemoryChangeSets);
        }
예제 #2
0
        public ISQLiteChangeSet Invert()
        {
            ISQLiteChangeSet sQLiteMemoryChangeSets;

            this.CheckDisposed();
            SQLiteSessionHelpers.CheckRawData(this.rawData);
            IntPtr zero   = IntPtr.Zero;
            IntPtr intPtr = IntPtr.Zero;

            try
            {
                int num = 0;
                zero = SQLiteBytes.ToIntPtr(this.rawData, ref num);
                int             num1            = 0;
                SQLiteErrorCode sQLiteErrorCode = UnsafeNativeMethods.sqlite3changeset_invert(num, zero, ref num1, ref intPtr);
                if (sQLiteErrorCode != SQLiteErrorCode.Ok)
                {
                    throw new SQLiteException(sQLiteErrorCode, "sqlite3changeset_invert");
                }
                byte[] numArray = SQLiteBytes.FromIntPtr(intPtr, num1);
                sQLiteMemoryChangeSets = new SQLiteMemoryChangeSet(numArray, base.GetHandle(), base.GetFlags());
            }
            finally
            {
                if (intPtr != IntPtr.Zero)
                {
                    SQLiteMemory.Free(intPtr);
                    intPtr = IntPtr.Zero;
                }
                if (zero != IntPtr.Zero)
                {
                    SQLiteMemory.Free(zero);
                    zero = IntPtr.Zero;
                }
            }
            return(sQLiteMemoryChangeSets);
        }