Exemplo n.º 1
0
        public static SQLiteMemoryChangeSetIterator Create(byte[] rawData)
        {
            SQLiteSessionHelpers.CheckRawData(rawData);
            SQLiteMemoryChangeSetIterator sQLiteMemoryChangeSetIterator = null;
            IntPtr zero   = IntPtr.Zero;
            IntPtr intPtr = IntPtr.Zero;

            try
            {
                int num = 0;
                zero = SQLiteBytes.ToIntPtr(rawData, ref num);
                if (zero == IntPtr.Zero)
                {
                    throw new SQLiteException(SQLiteErrorCode.NoMem, null);
                }
                SQLiteErrorCode sQLiteErrorCode = UnsafeNativeMethods.sqlite3changeset_start(ref intPtr, num, zero);
                if (sQLiteErrorCode != SQLiteErrorCode.Ok)
                {
                    throw new SQLiteException(sQLiteErrorCode, "sqlite3changeset_start");
                }
                sQLiteMemoryChangeSetIterator = new SQLiteMemoryChangeSetIterator(zero, intPtr, true);
            }
            finally
            {
                if (sQLiteMemoryChangeSetIterator == null)
                {
                    if (intPtr != IntPtr.Zero)
                    {
                        UnsafeNativeMethods.sqlite3changeset_finalize(intPtr);
                        intPtr = IntPtr.Zero;
                    }
                    if (zero != IntPtr.Zero)
                    {
                        SQLiteMemory.Free(zero);
                        zero = IntPtr.Zero;
                    }
                }
            }
            return(sQLiteMemoryChangeSetIterator);
        }
 public override void Reset()
 {
     this.CheckDisposed();
     base.ResetIterator(SQLiteMemoryChangeSetIterator.Create(this.rawData));
 }
 public SQLiteMemoryChangeSetEnumerator(byte[] rawData) : base(SQLiteMemoryChangeSetIterator.Create(rawData))
 {
     this.rawData = rawData;
 }