Index: System.Data.SQLite/SQLiteBase.cs ================================================================== --- System.Data.SQLite/SQLiteBase.cs +++ System.Data.SQLite/SQLiteBase.cs @@ -859,10 +859,22 @@ /// plain text (i.e. no numeric, date/time, or other conversions should /// be attempted). /// GetAllAsText = 0x100, + /// + /// Prevent this object instance from + /// loading extensions. + /// + NoLoadExtension = 0x200, + + /// + /// Prevent this object instance from + /// creating virtual table modules. + /// + NoCreateModule = 0x400, + /// /// When binding and returning column values, always treat them as though /// they were plain text (i.e. no numeric, date/time, or other conversions /// should be attempted). /// Index: System.Data.SQLite/SQLiteConnection.cs ================================================================== --- System.Data.SQLite/SQLiteConnection.cs +++ System.Data.SQLite/SQLiteConnection.cs @@ -1731,10 +1731,13 @@ throw new InvalidOperationException(String.Format( CultureInfo.CurrentCulture, "Database connection not valid for {0} extensions.", enable ? "enabling" : "disabling")); + if ((_flags & SQLiteConnectionFlags.NoLoadExtension) == SQLiteConnectionFlags.NoLoadExtension) + throw new SQLiteException("Loading extensions is disabled for this database connection."); + _sql.SetLoadExtension(enable); } /// /// Loads a SQLite extension library from the named dynamic link library file. @@ -1770,10 +1773,13 @@ if (_sql == null) throw new InvalidOperationException( "Database connection not valid for loading extensions."); + if ((_flags & SQLiteConnectionFlags.NoLoadExtension) == SQLiteConnectionFlags.NoLoadExtension) + throw new SQLiteException("Loading extensions is disabled for this database connection."); + _sql.LoadExtension(fileName, procName); } #if INTEROP_VIRTUAL_TABLE /// @@ -1790,10 +1796,13 @@ CheckDisposed(); if (_sql == null) throw new InvalidOperationException( "Database connection not valid for creating modules."); + + if ((_flags & SQLiteConnectionFlags.NoCreateModule) == SQLiteConnectionFlags.NoCreateModule) + throw new SQLiteException("Creating modules is disabled for this database connection."); _sql.CreateModule(module); } #endif