System.Data.SQLite

Check-in [131c0c6ebc]
Login

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

Overview
Comment:Minor tweaks and improvements
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: 131c0c6ebc0b2e327c9ce0277dc1813dd8354446
User & Date: rmsimpson 2006-07-02 06:50:07.000
Context
2006-07-02
07:30
Minor adjustments check-in: 24417781f0 user: rmsimpson tags: sourceforge
06:50
Minor tweaks and improvements check-in: 131c0c6ebc user: rmsimpson tags: sourceforge
06:48
Added sqlite3_key and rekey check-in: 02670a9729 user: rmsimpson tags: sourceforge
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/Program.cs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22





23
24
25
26
27












28
29
using System;
using System.Data;
using System.Text;
using System.Data.Common;
using System.Data.SQLite;

namespace test
{
  class Program
  {
    static void Main(string[] args)
    {
      DbProviderFactory fact;
      DbConnection cnn;

      System.IO.File.Delete("test.db3");

      using (cnn = new SQLiteConnection())
      {
        fact = DbProviderFactories.GetFactory("System.Data.SQLite");
        cnn.ConnectionString = "Data Source=test.db3";
        cnn.Open();





        TestCases.Run(fact, cnn);
      }

      Console.ReadKey();
    }












  }
}













|


|
<

<


>
>
>
>
>





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


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Data;
using System.Text;
using System.Data.Common;
using System.Data.SQLite;

namespace test
{
  class Program
  {
    static void Main(string[] args)
    {
      DbProviderFactory fact;
      fact = DbProviderFactories.GetFactory("System.Data.SQLite");

      System.IO.File.Delete("test.db3");
      using (DbConnection cnn = fact.CreateConnection())

      {

        cnn.ConnectionString = "Data Source=test.db3";
        cnn.Open();

        //cnn.Update += new SQLiteUpdateEventHandler(cnn_Updated);
        //cnn.Commit += new SQLiteCommitHandler(cnn_Commit);
        //cnn.RollBack += new EventHandler(cnn_RollBack);

        TestCases.Run(fact, cnn);
      }

      Console.ReadKey();
    }

    static void cnn_RollBack(object sender, EventArgs e)
    {
    }

    static void cnn_Commit(object sender, CommitEventArgs e)
    {
    }

    static void cnn_Updated(object sender, UpdateEventArgs e)
    {
    }
  }
}
Changes to test/TestCases.cs.
43
44
45
46
47
48
49















50
51
52
53
54
55
56
    }

    public override object Final(object contextData)
    {
      return contextData;
    }
  }
















  /// <summary>
  /// User-defined collating sequence.
  /// </summary>
  [SQLiteFunction(Name = "MYSEQUENCE", FuncType = FunctionType.Collation)]
  class MySequence : SQLiteFunction
  {







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







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
    }

    public override object Final(object contextData)
    {
      return contextData;
    }
  }

  /// <summary>
  /// Sample regular expression function.  Example Usage:
  /// SELECT * FROM foo WHERE name REGEXP '$bar'
  /// SELECT * FROM foo WHERE REGEXP('$bar', name)
  /// 
  /// </summary>
  [SQLiteFunction(Name = "REGEXP", Arguments = 2, FuncType = FunctionType.Scalar)]
  class MyRegEx : SQLiteFunction
  {
    public override object Invoke(object[] args)
    {
      return System.Text.RegularExpressions.Regex.IsMatch(Convert.ToString(args[1]), Convert.ToString(args[0]));
    }
  }

  /// <summary>
  /// User-defined collating sequence.
  /// </summary>
  [SQLiteFunction(Name = "MYSEQUENCE", FuncType = FunctionType.Collation)]
  class MySequence : SQLiteFunction
  {
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
      {
        cmd.CommandText = "SELECT COUNT(*) FROM VolatileTable";
        try
        {
          object o = cmd.ExecuteScalar();
          throw new InvalidOperationException("Transaction failed! The table exists!");
        }
        catch(SQLiteException e)
        {
          return; // Succeeded, the table should not have existed
        }
      }
    }

    internal static void CreateTable(DbConnection cnn)







|







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
      {
        cmd.CommandText = "SELECT COUNT(*) FROM VolatileTable";
        try
        {
          object o = cmd.ExecuteScalar();
          throw new InvalidOperationException("Transaction failed! The table exists!");
        }
        catch(SQLiteException)
        {
          return; // Succeeded, the table should not have existed
        }
      }
    }

    internal static void CreateTable(DbConnection cnn)