System.Data.SQLite
Check-in [e539f17af4]
Not logged in

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

Overview
Comment:Add an example to the SQLiteModuleEnumerable class doc comments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e539f17af4c2bd7ba1a17e50ffd39c9ae3ba93a1
User & Date: mistachkin 2013-06-26 18:17:47
Context
2013-06-26
23:50
Modify the index introspection code so that it does not treat PRAGMA table_info 'pk' column values as boolean. Fix for [f2c47a01eb]. check-in: 8d0c39afd2 user: mistachkin tags: trunk
18:17
Add an example to the SQLiteModuleEnumerable class doc comments. check-in: e539f17af4 user: mistachkin tags: trunk
04:52
Fixup external MSDN documentation links for the referenced generic interfaces. check-in: 0897c71426 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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

   213    213   
   214    214       #region SQLiteModuleEnumerable Class
   215    215       /// <summary>
   216    216       /// This class implements a virtual table module that exposes an
   217    217       /// <see cref="IEnumerable" /> object instance as a read-only virtual
   218    218       /// table.  It is not sealed and may be used as the base class for any
   219    219       /// user-defined virtual table class that wraps an
   220         -    /// <see cref="IEnumerable" /> object instance.
          220  +    /// <see cref="IEnumerable" /> object instance.  The following short
          221  +    /// example shows it being used to treat an array of strings as a table
          222  +    /// data source:
          223  +    /// <code>
          224  +    ///   public static class Sample
          225  +    ///   {
          226  +    ///     public static void Main()
          227  +    ///     {
          228  +    ///       using (SQLiteConnection connection = new SQLiteConnection(
          229  +    ///           "Data Source=:memory:;"))
          230  +    ///       {
          231  +    ///         connection.Open();
          232  +    ///
          233  +    ///         connection.CreateModule(new SQLiteModuleEnumerable(
          234  +    ///           "sampleModule", new string[] { "one", "two", "three" }));
          235  +    ///
          236  +    ///         using (SQLiteCommand command = connection.CreateCommand())
          237  +    ///         {
          238  +    ///           command.CommandText =
          239  +    ///               "CREATE VIRTUAL TABLE t1 USING sampleModule;";
          240  +    ///
          241  +    ///           command.ExecuteNonQuery();
          242  +    ///         }
          243  +    ///
          244  +    ///         using (SQLiteCommand command = connection.CreateCommand())
          245  +    ///         {
          246  +    ///           command.CommandText = "SELECT * FROM t1;";
          247  +    ///
          248  +    ///           using (SQLiteDataReader dataReader = command.ExecuteReader())
          249  +    ///           {
          250  +    ///             while (dataReader.Read())
          251  +    ///               Console.WriteLine(dataReader[0].ToString());
          252  +    ///           }
          253  +    ///         }
          254  +    ///
          255  +    ///         connection.Close();
          256  +    ///       }
          257  +    ///     }
          258  +    ///   }
          259  +    /// </code>
   221    260       /// </summary>
   222    261       public class SQLiteModuleEnumerable : SQLiteModuleNoop /* NOT SEALED */
   223    262       {
   224    263           #region Private Constants
   225    264           /// <summary>
   226    265           /// The CREATE TABLE statement used to declare the schema for the
   227    266           /// virtual table.
................................................................................
   301    340           /// The value of <see cref="SQLiteErrorCode.Error" />.
   302    341           /// </returns>
   303    342           protected virtual SQLiteErrorCode CursorEndOfEnumeratorError(
   304    343               SQLiteVirtualTableCursor cursor
   305    344               )
   306    345           {
   307    346               SetCursorError(cursor, "already hit end of enumerator");
   308         -            return SQLiteErrorCode.Error; 
          347  +            return SQLiteErrorCode.Error;
   309    348           }
   310    349   
   311    350           ///////////////////////////////////////////////////////////////////////
   312    351   
   313    352           /// <summary>
   314    353           /// Determines the string to return as the column value for the object
   315    354           /// instance value.