Example #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);
        }
        public ISQLiteChangeSet CombineWith(ISQLiteChangeSet changeSet)
        {
            this.CheckDisposed();
            this.CheckInputStream();
            this.CheckOutputStream();
            SQLiteStreamChangeSet sQLiteStreamChangeSets = changeSet as SQLiteStreamChangeSet;

            if (sQLiteStreamChangeSets == null)
            {
                throw new ArgumentException("not a stream based change set", "changeSet");
            }
            sQLiteStreamChangeSets.CheckInputStream();
            SQLiteErrorCode sQLiteErrorCode = UnsafeNativeMethods.sqlite3changeset_concat_strm(this.inputStreamAdapter.GetInputDelegate(), IntPtr.Zero, sQLiteStreamChangeSets.inputStreamAdapter.GetInputDelegate(), IntPtr.Zero, this.outputStreamAdapter.GetOutputDelegate(), IntPtr.Zero);

            if (sQLiteErrorCode != SQLiteErrorCode.Ok)
            {
                throw new SQLiteException(sQLiteErrorCode, "sqlite3changeset_concat_strm");
            }
            return(null);
        }