private void DisposeStreamAdapters() { if (this.streamAdapters == null) { return; } foreach (KeyValuePair <Stream, SQLiteStreamAdapter> streamAdapter in this.streamAdapters) { SQLiteStreamAdapter value = streamAdapter.Value; if (value == null) { continue; } value.Dispose(); } this.streamAdapters.Clear(); this.streamAdapters = null; }
public static SQLiteStreamChangeSetIterator Create(Stream stream, SQLiteConnectionFlags flags) { if (stream == null) { throw new ArgumentNullException("stream"); } SQLiteStreamAdapter sQLiteStreamAdapter = null; SQLiteStreamChangeSetIterator sQLiteStreamChangeSetIterator = null; IntPtr zero = IntPtr.Zero; try { sQLiteStreamAdapter = new SQLiteStreamAdapter(stream, flags); SQLiteErrorCode sQLiteErrorCode = UnsafeNativeMethods.sqlite3changeset_start_strm(ref zero, sQLiteStreamAdapter.GetInputDelegate(), IntPtr.Zero); if (sQLiteErrorCode != SQLiteErrorCode.Ok) { throw new SQLiteException(sQLiteErrorCode, "sqlite3changeset_start_strm"); } sQLiteStreamChangeSetIterator = new SQLiteStreamChangeSetIterator(sQLiteStreamAdapter, zero, true); } finally { if (sQLiteStreamChangeSetIterator == null) { if (zero != IntPtr.Zero) { UnsafeNativeMethods.sqlite3changeset_finalize(zero); zero = IntPtr.Zero; } if (sQLiteStreamAdapter != null) { sQLiteStreamAdapter.Dispose(); sQLiteStreamAdapter = null; } } } return(sQLiteStreamChangeSetIterator); }