protected UnsafeNativeMethods.xSessionConflict GetDelegate(SessionConflictCallback conflictCallback, object clientData)
 {
     if (conflictCallback == null)
     {
         return(null);
     }
     return((IntPtr context, SQLiteChangeSetConflictType type, IntPtr iterator) => {
         SQLiteChangeSetConflictResult sQLiteChangeSetConflictResult;
         try
         {
             ISQLiteChangeSetMetadataItem sQLiteChangeSetMetadataItem = this.CreateMetadataItem(iterator);
             if (sQLiteChangeSetMetadataItem == null)
             {
                 throw new SQLiteException("could not create metadata item");
             }
             sQLiteChangeSetConflictResult = conflictCallback(clientData, type, sQLiteChangeSetMetadataItem);
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             try
             {
                 if (HelperMethods.LogCallbackExceptions(base.GetFlags()))
                 {
                     SQLiteLog.LogMessage(-2146233088, HelperMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"{0}\" method: {1}", new object[] { "xSessionConflict", exception }));
                 }
             }
             catch
             {
             }
             return SQLiteChangeSetConflictResult.Abort;
         }
         return sQLiteChangeSetConflictResult;
     });
 }
Ejemplo n.º 2
0
        public void Apply(SessionConflictCallback conflictCallback, SessionTableFilterCallback tableFilterCallback, object clientData)
        {
            this.CheckDisposed();
            SQLiteSessionHelpers.CheckRawData(this.rawData);
            if (conflictCallback == null)
            {
                throw new ArgumentNullException("conflictCallback");
            }
            UnsafeNativeMethods.xSessionFilter   @delegate         = base.GetDelegate(tableFilterCallback, clientData);
            UnsafeNativeMethods.xSessionConflict _xSessionConflict = base.GetDelegate(conflictCallback, clientData);
            IntPtr zero = IntPtr.Zero;

            try
            {
                int num = 0;
                zero = SQLiteBytes.ToIntPtr(this.rawData, ref num);
                SQLiteErrorCode sQLiteErrorCode = UnsafeNativeMethods.sqlite3changeset_apply(base.GetIntPtr(), num, zero, @delegate, _xSessionConflict, IntPtr.Zero);
                if (sQLiteErrorCode != SQLiteErrorCode.Ok)
                {
                    throw new SQLiteException(sQLiteErrorCode, "sqlite3changeset_apply");
                }
            }
            finally
            {
                if (zero != IntPtr.Zero)
                {
                    SQLiteMemory.Free(zero);
                    zero = IntPtr.Zero;
                }
            }
        }
        public void Apply(SessionConflictCallback conflictCallback, SessionTableFilterCallback tableFilterCallback, object clientData)
        {
            this.CheckDisposed();
            this.CheckInputStream();
            if (conflictCallback == null)
            {
                throw new ArgumentNullException("conflictCallback");
            }
            UnsafeNativeMethods.xSessionFilter   @delegate         = base.GetDelegate(tableFilterCallback, clientData);
            UnsafeNativeMethods.xSessionConflict _xSessionConflict = base.GetDelegate(conflictCallback, clientData);
            SQLiteErrorCode sQLiteErrorCode = UnsafeNativeMethods.sqlite3changeset_apply_strm(base.GetIntPtr(), this.inputStreamAdapter.GetInputDelegate(), IntPtr.Zero, @delegate, _xSessionConflict, IntPtr.Zero);

            if (sQLiteErrorCode != SQLiteErrorCode.Ok)
            {
                throw new SQLiteException(sQLiteErrorCode, "sqlite3changeset_apply_strm");
            }
        }
Ejemplo n.º 4
0
 public void Apply(SessionConflictCallback conflictCallback, object clientData)
 {
     this.CheckDisposed();
     this.Apply(conflictCallback, null, clientData);
 }