System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation

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

Changes In Branch tkt-e235a52c82 Excluding Merge-Ins

This is equivalent to a diff from 0ca77b6031 to 4ebae8bc82

2013-01-30
01:00
Support automatic value conversions for columns with a declared type of INTEGER8, INTEGER16, INTEGER32, INTEGER64, UNSIGNEDINTEGER, UNSIGNEDINTEGER8, UNSIGNEDINTEGER16, UNSIGNEDINTEGER32, UNSIGNEDINTEGER64, INT8, INT16, INT32, INT64, UINT, UINT8, UINT16, UINT32, or UINT64. check-in: ad2b42f3cc user: mistachkin tags: trunk
2013-01-29
20:39
Skip checking loaded assemblies for classes tagged with the SQLiteFunction attribute when the No_SQLiteFunctions environment variable is set. check-in: 52000f7d30 user: mistachkin tags: skipFunctions
06:35
Fix-up spacing on section separators. Closed-Leaf check-in: 4ebae8bc82 user: mistachkin tags: tkt-e235a52c82
05:33
Enhance test case for ticket [e235a52c82] to demonstrate the effects that different default isolation levels have on created transactions. check-in: a354a124a5 user: mistachkin tags: tkt-e235a52c82
03:35
Add test pursuant to ticket [e235a52c82]. check-in: 4647779e7a user: mistachkin tags: tkt-e235a52c82
03:34
Remove superfluous 'using' statements from some tests. check-in: 0ca77b6031 user: mistachkin tags: trunk
2013-01-17
21:01
Bump all versions to 1.0.85.0. Add static Execute method to the SQLiteCommand class. Add public constructor to the SQLiteDataAdapter class that allows passing the parseViaFramework parameter to the SQLiteConnection constructor. When built with the CHECK_STATE compile-time option, skip throwing exceptions from the SQLiteDataReader class when the object is being disposed. check-in: b2c5c6e2a0 user: mistachkin tags: trunk

Added Tests/tkt-e235a52c82.eagle.







































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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
###############################################################################
#
# tkt-e235a52c82.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

for {set i 1} {$i < 3} {incr i} {
  runTest {test [appendArgs tkt-e235a52c82-1. $i] {isolation level} \
      -setup {
    set fileName [appendArgs tkt-e235a52c82-1. $i .db]
    set isolationLevel [expr {$i == 1 ? "ReadCommitted" : "Serializable"}]
  } -body {
    setupDb $fileName

    sql execute $db {
      CREATE TABLE t1(x);
      INSERT INTO t1 (x) VALUES('1');
      INSERT INTO t1 (x) VALUES('2');
    }

    cleanupDb $fileName db true false false

    set id [object invoke Interpreter.GetActive NextId]
    set dataSource [file join [getDatabaseDirectory] $fileName]

    set sql { \
      SELECT x FROM t1 ORDER BY x; \
    }

    unset -nocomplain results errors

    set code [compileCSharpWith [subst {
      using System;
      using System.Data;
      using System.Data.SQLite;

      namespace _Dynamic${id}
      {
        public sealed class Query${id}
        {
          private IDbConnection connection;
          private IDbTransaction transaction;
          private bool opened;

          /////////////////////////////////////////////////////////////////////

          private void EnsureConnection()
          {
            if (connection == null)
            {
              connection = new SQLiteConnection("Data Source=${dataSource};" +
                  "Default IsolationLevel=${isolationLevel};");
            }

            if (connection.State == ConnectionState.Closed)
            {
              connection.Open();
              opened = true;
            }

            if (transaction == null)
              transaction = connection.BeginTransaction();
          }

          /////////////////////////////////////////////////////////////////////

          private void ReleaseConnection()
          {
            if (connection == null)
              throw new Exception("cannot release connection");

            if (opened)
            {
              connection.Close();
              opened = false;
            }
          }

          /////////////////////////////////////////////////////////////////////

          private IDbCommand CreateCommand(
            string commandText
            )
          {
            if (connection == null)
              throw new Exception("cannot create command");

            IDbCommand command = connection.CreateCommand();
            command.CommandText = commandText;

            return command;
          }

          /////////////////////////////////////////////////////////////////////

          public object ExecuteReader(
            string commandText
            )
          {
            object result;
            EnsureConnection();
            IDataReader reader = null;

            try
            {
              reader = CreateCommand(commandText).ExecuteReader();
            }
            catch
            {
              ReleaseConnection();
              throw;
            }

            ///////////////////////////////////////////////////////////////////

            try
            {
              result = reader.GetValue(0);
            }
            catch
            {
              reader.Dispose();
              ReleaseConnection();
              throw;
            }

            return result;
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static class Test${id}
        {
          public static string\[\] GetData()
          {
            return new string\[\] {
              new Query${id}().ExecuteReader("${sql}").ToString(),
              new Query${id}().ExecuteReader("${sql}").ToString()
            };
          }

          /////////////////////////////////////////////////////////////////////

          public static void Main()
          {
            // do nothing.
          }
        }
      }
    }] true true true results errors System.Data.SQLite.dll]

    list $code $results \
        [expr {[info exists errors] ? $errors : ""}] \
        [expr {$code eq "Ok" ? [catch {
          object invoke _Dynamic${id}.Test${id} GetData
        } result] : [set result ""]}] $result
  } -cleanup {
    cleanupDb $fileName

    unset -nocomplain result results errors code sql dataSource id db \
        isolationLevel fileName
  } -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result [expr {$i == 1 ? {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{1 1\}$} : {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 1\
\{System\.Reflection\.TargetInvocationException: Exception has been thrown by\
the target of an invocation\. ---> System\.Data\.SQLite\.SQLiteException:\
database is locked.*$}}]}
}

###############################################################################

unset -nocomplain i

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue