protected UnsafeNativeMethods.xSessionFilter GetDelegate(SessionTableFilterCallback tableFilterCallback, object clientData) { if (tableFilterCallback == null) { return(null); } return((IntPtr context, IntPtr pTblName) => { int num; try { string str = SQLiteString.StringFromUtf8IntPtr(pTblName); num = (tableFilterCallback(clientData, str) ? 1 : 0); } 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[] { "xSessionFilter", exception })); } } catch { } return 0; } return num; }); }
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"); } }
private UnsafeNativeMethods.xSessionFilter ApplyTableFilter(SessionTableFilterCallback callback, object clientData) { this.tableFilterCallback = callback; this.tableFilterClientData = clientData; if (callback == null) { if (this.xFilter != null) { this.xFilter = null; } return(null); } if (this.xFilter == null) { this.xFilter = new UnsafeNativeMethods.xSessionFilter(this.Filter); } return(this.xFilter); }
public void SetTableFilter(SessionTableFilterCallback callback, object clientData) { this.CheckDisposed(); this.CheckHandle(); UnsafeNativeMethods.sqlite3session_table_filter(this.session, this.ApplyTableFilter(callback, clientData), IntPtr.Zero); }