System.Data.SQLite
Check-in [1e947f24b6]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add connection flags to allow loading of extensions and the creation of modules to be disabled.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | virtualTables
Files: files | file ages | folders
SHA1: 1e947f24b66b1d897e588c5164c43a441e8b62ce
User & Date: mistachkin 2013-06-25 21:49:20
Context
2013-06-25
21:50
Add all the necessary infrastructure to allow virtual tables to be implemented in managed code. Fix for [9a544991be]. check-in: 2d35b79c48 user: mistachkin tags: trunk
21:49
Add connection flags to allow loading of extensions and the creation of modules to be disabled. Closed-Leaf check-in: 1e947f24b6 user: mistachkin tags: virtualTables
21:31
Modify the CHM building tool to fix internal links to inherited members. check-in: c888a45583 user: mistachkin tags: virtualTables
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite/SQLiteBase.cs.

   857    857         /// <summary>
   858    858         /// When returning column values, always return them as though they were
   859    859         /// plain text (i.e. no numeric, date/time, or other conversions should
   860    860         /// be attempted).
   861    861         /// </summary>
   862    862         GetAllAsText = 0x100,
   863    863   
          864  +      /// <summary>
          865  +      /// Prevent this <see cref="SQLiteConnection" /> object instance from
          866  +      /// loading extensions.
          867  +      /// </summary>
          868  +      NoLoadExtension = 0x200,
          869  +
          870  +      /// <summary>
          871  +      /// Prevent this <see cref="SQLiteConnection" /> object instance from
          872  +      /// creating virtual table modules.
          873  +      /// </summary>
          874  +      NoCreateModule = 0x400,
          875  +
   864    876         /// <summary>
   865    877         /// When binding and returning column values, always treat them as though
   866    878         /// they were plain text (i.e. no numeric, date/time, or other conversions
   867    879         /// should be attempted).
   868    880         /// </summary>
   869    881         BindAndGetAllAsText = BindAllAsText | GetAllAsText,
   870    882   

Changes to System.Data.SQLite/SQLiteConnection.cs.

  1729   1729   
  1730   1730           if (_sql == null)
  1731   1731               throw new InvalidOperationException(String.Format(
  1732   1732                   CultureInfo.CurrentCulture,
  1733   1733                   "Database connection not valid for {0} extensions.",
  1734   1734                   enable ? "enabling" : "disabling"));
  1735   1735   
         1736  +        if ((_flags & SQLiteConnectionFlags.NoLoadExtension) == SQLiteConnectionFlags.NoLoadExtension)
         1737  +            throw new SQLiteException("Loading extensions is disabled for this database connection.");
         1738  +
  1736   1739           _sql.SetLoadExtension(enable);
  1737   1740       }
  1738   1741   
  1739   1742       /// <summary>
  1740   1743       /// Loads a SQLite extension library from the named dynamic link library file.
  1741   1744       /// </summary>
  1742   1745       /// <param name="fileName">
................................................................................
  1768   1771       {
  1769   1772           CheckDisposed();
  1770   1773   
  1771   1774           if (_sql == null)
  1772   1775               throw new InvalidOperationException(
  1773   1776                   "Database connection not valid for loading extensions.");
  1774   1777   
         1778  +        if ((_flags & SQLiteConnectionFlags.NoLoadExtension) == SQLiteConnectionFlags.NoLoadExtension)
         1779  +            throw new SQLiteException("Loading extensions is disabled for this database connection.");
         1780  +
  1775   1781           _sql.LoadExtension(fileName, procName);
  1776   1782       }
  1777   1783   
  1778   1784   #if INTEROP_VIRTUAL_TABLE
  1779   1785       /// <summary>
  1780   1786       /// Creates a disposable module containing the implementation of a virtual
  1781   1787       /// table.
................................................................................
  1788   1794           )
  1789   1795       {
  1790   1796           CheckDisposed();
  1791   1797   
  1792   1798           if (_sql == null)
  1793   1799               throw new InvalidOperationException(
  1794   1800                   "Database connection not valid for creating modules.");
         1801  +
         1802  +        if ((_flags & SQLiteConnectionFlags.NoCreateModule) == SQLiteConnectionFlags.NoCreateModule)
         1803  +            throw new SQLiteException("Creating modules is disabled for this database connection.");
  1795   1804   
  1796   1805           _sql.CreateModule(module);
  1797   1806       }
  1798   1807   #endif
  1799   1808   
  1800   1809       /// <summary>
  1801   1810       /// Parses a string containing a sequence of zero or more hexadecimal