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-3b9dcdc32d Excluding Merge-Ins

This is equivalent to a diff from 3b2aa14e3e to 0ac2dc31fe

2011-11-28
06:32
Final doc updates for release 77. check-in: a133cebbc4 user: mistachkin tags: trunk
04:02
Remove superfluous logging from test. Closed-Leaf check-in: 0ac2dc31fe user: mistachkin tags: tkt-3b9dcdc32d
04:01
Enhance/add tests to check memory usage related to ticket [3b9dcdc32d]. check-in: b3d05f0aa0 user: mistachkin tags: tkt-3b9dcdc32d
2011-11-27
12:26
First attempt to reproduce the issue described in ticket [3b9dcdc32d]. check-in: 85b23122e0 user: mistachkin tags: tkt-3b9dcdc32d
09:30
Update Eagle in externals to the latest pre-beta20 bits, modifying unit tests as necessary. Update source archive exclusions file to omit NDoc3 and HtmlHelp from externals. check-in: 3b2aa14e3e user: mistachkin tags: trunk
08:44
More doc updates for release 77. check-in: 6dea1870d5 user: mistachkin tags: trunk

Added Tests/tkt-3b9dcdc32d.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
###############################################################################
#
# tkt-3b9dcdc32d.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require EagleLibrary
package require EagleTest

runTestPrologue

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

package require System.Data.SQLite.Test
runSQLiteTestPrologue

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

runTest {test tkt-3b9dcdc32d-1.1 {ZEROBLOB memory leak} -setup {
  set memory_used(before) [reportSQLiteResources stdout]
  setupDb [set fileName tkt-3b9dcdc32d-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER, y BLOB NULL, z BLOB NULL);"

  for {set i 1} {$i < 10} {incr i} {
    sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
        [list param1 String $i]

    sql execute $db \
        "UPDATE t1 SET y = ZEROBLOB(10 * 1024 * 1024) WHERE rowid = ?;" \
        [list param1 String $i]

    sql execute $db "UPDATE t1 SET z = ZEROBLOB(10) WHERE rowid = ?;" \
        [list param1 String $i]
  }

  set result [sql execute -execute reader -format list $db \
      "SELECT x, LENGTH(y), LENGTH(z) FROM t1 ORDER BY x;"]

  cleanupDb $fileName; unset -nocomplain db fileName
  set memory_used(after) [reportSQLiteResources stdout]

  list [expr {$memory_used(after) - $memory_used(before)}] $result
} -cleanup {
  if {[info exists fileName]} then {
    cleanupDb $fileName
  }

  unset -nocomplain memory_used db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{0 {1 10485760 10 2 10485760 10 3 10485760 10 4 10485760 10 5 10485760 10 6\
10485760 10 7 10485760 10 8 10485760 10 9 10485760 10}}}

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

set memory_used(before) [reportSQLiteResources stdout]

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

runTest {test tkt-3b9dcdc32d-1.2 {ZEROBLOB leak} -setup {
  set fileName tkt-3b9dcdc32d-1.2.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getTemporaryPath] $fileName]
  set name [file rootname [file tail $fileName]]

  set sql(1) { \
    CREATE TABLE t1(x INTEGER, y BLOB NULL, z BLOB NULL); \
  }

  set sql(2) { \
    INSERT INTO t1 (x) VALUES(10); \
  }

  set sql(3) { \
    UPDATE t1 SET y = ZEROBLOB(10 * 1024 * 1024) WHERE rowid = 1; \
  }

  set sql(4) { \
    UPDATE t1 SET z = ZEROBLOB(10) WHERE rowid = 1; \
  }

  unset -nocomplain results errors

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

    namespace _Dynamic${id}
    {
      public class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};"))
          {
            connection.Open();

            SQLiteCommand command1 = new SQLiteCommand("${sql(1)}",
                connection);

            command1.ExecuteNonQuery();

            SQLiteCommand command2 = new SQLiteCommand("${sql(2)}",
                connection);

            command2.ExecuteNonQuery();

            SQLiteCommand command3 = new SQLiteCommand("${sql(3)}",
                connection);

            command3.ExecuteNonQuery();

            SQLiteCommand command4 = new SQLiteCommand("${sql(4)}",
                connection);

            command4.ExecuteNonQuery();
          }

          GC.Collect();
          GC.WaitForPendingFinalizers();
          GC.Collect();
        }
      }
    }
  }] 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} Main
      } result] : [set result ""]}] $result \
      [set memory_used(after) [reportSQLiteResources stdout]]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id db fileName
} -constraints \
{eagle logFile monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-match regexp -result [appendArgs "^Ok\
System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} 0 \\{\\} "\
$memory_used(before) \$]}

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

unset -nocomplain memory_used

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

runSQLiteTestEpilogue
runTestEpilogue