System.Data.SQLite

Check-in [f49beb5b02]
Login

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

Overview
Comment:Add backup API test case for the callback returning false.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f49beb5b020289ade6c88f507c85e9829a93ee08
User & Date: mistachkin 2012-03-26 09:45:08.312
Context
2012-03-26
09:52
When compiled for the .NET Compact Framework, skip catching, logging, and re-throwing exceptions in the BackupDatabase method. check-in: a413c10b32 user: mistachkin tags: trunk
09:45
Add backup API test case for the callback returning false. check-in: f49beb5b02 user: mistachkin tags: trunk
09:18
Make all the dynamic test classes static, when possible. check-in: 3f6ed3b646 user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Tests/backup.eagle.
16
17
18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

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

set params(pages) [list -1 -1 0 0 1 1 1000 1000]

set params(callbacks) [list null "new SQLiteBackupCallback(BackupCallback)" \

                            null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)"]

set params(results) [list \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \







|


>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

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

set params(pages) [list -1 -1 0 0 1 1 2 2 1000 1000]

set params(callbacks) [list null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)"]

set params(results) [list \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \
40
41
42
43
44
45
46






47
48
49
50
51
52
53
    thrown by the target of an invocation\\. --->\
    System\\.Data\\.SQLite\\.SQLiteException: SQLite error\\r\\nno such table:\
    t1\\r\\n.*?" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 10283\$" \






    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} \\{\\}\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} \\{System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 9284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 8284 10284 False\







>
>
>
>
>
>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    thrown by the target of an invocation\\. --->\
    System\\.Data\\.SQLite\\.SQLiteException: SQLite error\\r\\nno such table:\
    t1\\r\\n.*?" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 10283\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \
    "1 \\{System\\.Reflection\\.TargetInvocationException: Exception has been\
    thrown by the target of an invocation\\. --->\
    System\\.Data\\.SQLite\\.SQLiteException: SQLite error\\r\\nno such table:\
    t1\\r\\n.*?" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} \\{\\}\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} \\{System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 9284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 8284 10284 False\
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
          {
            results.AppendFormat("{0} {1} {2} {3} {4} {5} {6} {7} ", source,
              sourceName, destination, destinationName, pages, remainingPages,
              totalPages, retry);

            count++;

            return true;
          }

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

          public static string BackupAndGetData(
            Interpreter interpreter,
            SQLiteConnection source







|







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
          {
            results.AppendFormat("{0} {1} {2} {3} {4} {5} {6} {7} ", source,
              sourceName, destination, destinationName, pages, remainingPages,
              totalPages, retry);

            count++;

            return (pages != 2);
          }

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

          public static string BackupAndGetData(
            Interpreter interpreter,
            SQLiteConnection source
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
              source.BackupDatabase(destination, "main", "main", pages,
                ${callback}, 0);

              ReturnCode code;
              Result error = null;

              code = interpreter.SetVariableValue(
                VariableFlags.GlobalOnly, "callbackResults", (pages > 1) ?
                    results.ToString().Trim() : count.ToString(), null,
                ref error);

              if (code != ReturnCode.Ok)
                Utility.Complain(interpreter, code, error);

              using (SQLiteCommand command = new SQLiteCommand(







|







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
              source.BackupDatabase(destination, "main", "main", pages,
                ${callback}, 0);

              ReturnCode code;
              Result error = null;

              code = interpreter.SetVariableValue(
                VariableFlags.GlobalOnly, "callbackResults", (pages > 2) ?
                    results.ToString().Trim() : count.ToString(), null,
                ref error);

              if (code != ReturnCode.Ok)
                Utility.Complain(interpreter, code, error);

              using (SQLiteCommand command = new SQLiteCommand(
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
  } -cleanup {
    cleanupDb $fileName(2)
    cleanupDb $fileName(1) memDb

    unset -nocomplain result results errors code index memSource dataSource \
        id memDb db fileName callbackResults
  } -constraints \
  {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-match regexp -result [appendArgs \
"^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} " \
[lindex $params(results) $i]]}
}

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

unset -nocomplain i params pages callback

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

runSQLiteTestEpilogue
runTestEpilogue







|













211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
  } -cleanup {
    cleanupDb $fileName(2)
    cleanupDb $fileName(1) memDb

    unset -nocomplain result results errors code index memSource dataSource \
        id memDb db fileName callbackResults
  } -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-match regexp -result [appendArgs \
"^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} " \
[lindex $params(results) $i]]}
}

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

unset -nocomplain i params pages callback

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

runSQLiteTestEpilogue
runTestEpilogue