Index: System.Data.SQLite/SQLiteCommand.cs
==================================================================
--- System.Data.SQLite/SQLiteCommand.cs
+++ System.Data.SQLite/SQLiteCommand.cs
@@ -279,10 +279,28 @@
return SQLiteConnectionFlags.Default;
}
///////////////////////////////////////////////////////////////////////////////////////////////
+ private void DisposeStatements()
+ {
+ if (_statementList == null) return;
+
+ int x = _statementList.Count;
+
+ for (int n = 0; n < x; n++)
+ {
+ SQLiteStatement stmt = _statementList[n];
+ if (stmt == null) continue;
+ stmt.Dispose();
+ }
+
+ _statementList = null;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////
+
///
/// Clears and destroys all statements currently prepared
///
internal void ClearCommands()
{
@@ -301,17 +319,11 @@
reader.Close();
_activeReader = null;
}
- if (_statementList == null) return;
-
- int x = _statementList.Count;
- for (int n = 0; n < x; n++)
- _statementList[n].Dispose();
-
- _statementList = null;
+ DisposeStatements();
_parameterCollection.Unbind();
}
///