System.Data.SQLite

Check-in [8db4cc27ac]
Login

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

Overview
Comment:Full Text search test
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: 8db4cc27ac9967cab60f4b5caf8364d499e56e6d
User & Date: rmsimpson 2006-10-16 17:00:39.000
Context
2006-10-23
21:28
1.0.36.0 check-in: b23bfc47c3 user: rmsimpson tags: sourceforge
2006-10-16
17:00
Full Text search test check-in: 8db4cc27ac user: rmsimpson tags: sourceforge
14:51
Add smalldate and smalldatetime check-in: c655bb861a user: rmsimpson tags: sourceforge
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/TestCases.cs.
81
82
83
84
85
86
87



88
89
90
91
92
93
94
  internal class TestCases
  {
    internal static void Run(DbProviderFactory fact, DbConnection cnn)
    {
      Console.WriteLine("\r\nBeginning Test on " + cnn.GetType().ToString());
      try { CreateTable(cnn); Console.WriteLine("SUCCESS - CreateTable"); }
      catch (Exception) { Console.WriteLine("FAIL - CreateTable"); }




      try { TransactionTest(cnn); Console.WriteLine("SUCCESS - Transaction Enlistment"); }
      catch (Exception) { Console.WriteLine("FAIL - Transaction Enlistment"); }

      try { GuidTest(cnn); Console.WriteLine("SUCCESS - Guid Test"); }
      catch (Exception) { Console.WriteLine("FAIL - Guid Test"); }








>
>
>







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
  internal class TestCases
  {
    internal static void Run(DbProviderFactory fact, DbConnection cnn)
    {
      Console.WriteLine("\r\nBeginning Test on " + cnn.GetType().ToString());
      try { CreateTable(cnn); Console.WriteLine("SUCCESS - CreateTable"); }
      catch (Exception) { Console.WriteLine("FAIL - CreateTable"); }

      try { FullTextTest(cnn); Console.WriteLine("SUCCESS - Full Text Search"); }
      catch (Exception) { Console.WriteLine("FAIL - Full Text Search"); }

      try { TransactionTest(cnn); Console.WriteLine("SUCCESS - Transaction Enlistment"); }
      catch (Exception) { Console.WriteLine("FAIL - Transaction Enlistment"); }

      try { GuidTest(cnn); Console.WriteLine("SUCCESS - Guid Test"); }
      catch (Exception) { Console.WriteLine("FAIL - Guid Test"); }

142
143
144
145
146
147
148














































149
150
151
152
153
154
155

      try { DropTable(cnn); Console.WriteLine("SUCCESS - DropTable"); }
      catch (Exception) { Console.WriteLine("FAIL - DropTable"); }

      Console.WriteLine("\r\nTests Finished.");
    }















































    internal static void TransactionTest(DbConnection cnn)
    {
      using (TransactionScope scope = new TransactionScope())
      {
        using (DbConnection cnn2 = ((ICloneable)cnn).Clone() as DbConnection)
        {
          using (DbCommand cmd = cnn2.CreateCommand())







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204

      try { DropTable(cnn); Console.WriteLine("SUCCESS - DropTable"); }
      catch (Exception) { Console.WriteLine("FAIL - DropTable"); }

      Console.WriteLine("\r\nTests Finished.");
    }

    internal static void FullTextTest(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "CREATE VIRTUAL TABLE FullText USING FTS1(name, ingredients);";
        cmd.ExecuteNonQuery();

        string[] names = { "broccoli stew", "pumpkin stew", "broccoli pie", "pumpkin pie" };
        string[] ingredients = { "broccoli peppers cheese tomatoes", "pumpkin onions garlic celery", "broccoli cheese onions flour", "pumpkin sugar flour butter" };
        int n;

        cmd.CommandText = "insert into FullText (name, ingredients) values (@name, @ingredient);";
        DbParameter name = cmd.CreateParameter();
        DbParameter ingredient = cmd.CreateParameter();

        name.ParameterName = "@name";
        ingredient.ParameterName = "@ingredient";

        cmd.Parameters.Add(name);
        cmd.Parameters.Add(ingredient);

        for (n = 0; n < names.Length; n++)
        {
          name.Value = names[n];
          ingredient.Value = ingredients[n];

          cmd.ExecuteNonQuery();
        }

        cmd.CommandText = "select rowid, name, ingredients from FullText where name match 'pie';";

        int[] rowids = { 3, 4 };
        n = 0;

        using (DbDataReader reader = cmd.ExecuteReader())
        {
          while (reader.Read())
          {
            if (reader.GetInt64(0) != rowids[n++])
              throw new ArgumentException("Unexpected rowid returned");

            if (n > rowids.Length) throw new ArgumentException("Too many rows returned");
          }
        }
      }
    }
    internal static void TransactionTest(DbConnection cnn)
    {
      using (TransactionScope scope = new TransactionScope())
      {
        using (DbConnection cnn2 = ((ICloneable)cnn).Clone() as DbConnection)
        {
          using (DbCommand cmd = cnn2.CreateCommand())