System.Data.SQLite
Check-in [b0c9d60ac7]
Not logged in

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

Overview
Comment:After disposing and just prior to re-creating the SQLiteKeyReader in the SQLiteDataReader.LoadKeyInfo method, reset it to null (i.e. this is important due to reentrancy issues). Fix for ticket [3aa50d8413].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b0c9d60ac721d3f0a2be9481f03575c0e51704c9
User & Date: mistachkin 2012-05-25 23:28:19
References
2012-05-25
23:36 Ticket [3aa50d8413] SQLiteDataAdapter.FillSchema throws NullReferenceException with multiple result sets status still Closed with 1 other change artifact: d1347df27a user: mistachkin
23:28 Closed ticket [3aa50d8413]. artifact: 4891954f10 user: mistachkin
Context
2012-05-26
00:09
Correct the test name for ticket [3aa50d8413]. check-in: 3e7d4b68b0 user: mistachkin tags: trunk
2012-05-25
23:28
After disposing and just prior to re-creating the SQLiteKeyReader in the SQLiteDataReader.LoadKeyInfo method, reset it to null (i.e. this is important due to reentrancy issues). Fix for ticket [3aa50d8413]. check-in: b0c9d60ac7 user: mistachkin tags: trunk
2012-05-23
07:32
Update SQLite native library to the 3.7.12.1 release. check-in: 0374c60dce user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite/SQLiteDataReader.cs.

1309
1310
1311
1312
1313
1314
1315
1316

1317

1318

1319
1320
1321
1322
    public override object this[int i]
    {
      get { CheckDisposed(); return GetValue(i); }
    }

    private void LoadKeyInfo()
    {
      if (_keyInfo != null)

        _keyInfo.Dispose();



      _keyInfo = new SQLiteKeyReader(_command.Connection, this, _activeStatement);
    }
  }
}







|
>
|
>
|
>
|



1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
    public override object this[int i]
    {
      get { CheckDisposed(); return GetValue(i); }
    }

    private void LoadKeyInfo()
    {
        if (_keyInfo != null)
        {
            _keyInfo.Dispose();
            _keyInfo = null;
        }

        _keyInfo = new SQLiteKeyReader(_command.Connection, this, _activeStatement);
    }
  }
}

Changes to System.Data.SQLite/SQLiteKeyReader.cs.

341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356

357
358
359
360
361
362
363
            {
                ////////////////////////////////////
                // dispose managed resources here...
                ////////////////////////////////////

                _stmt = null;

                if (_keyInfo == null) return;

                for (int n = 0; n < _keyInfo.Length; n++)
                {
                    if (_keyInfo[n].query != null)
                        _keyInfo[n].query.Dispose();
                }

                _keyInfo = null;

            }

            //////////////////////////////////////
            // release unmanaged resources here...
            //////////////////////////////////////

            disposed = true;







|
|
|
|
|
|
|

|
>







341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
            {
                ////////////////////////////////////
                // dispose managed resources here...
                ////////////////////////////////////

                _stmt = null;

                if (_keyInfo != null)
                {
                    for (int n = 0; n < _keyInfo.Length; n++)
                    {
                        if (_keyInfo[n].query != null)
                            _keyInfo[n].query.Dispose();
                    }

                    _keyInfo = null;
                }
            }

            //////////////////////////////////////
            // release unmanaged resources here...
            //////////////////////////////////////

            disposed = true;

Added Tests/tkt-3aa50d8413.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
###############################################################################
#
# tkt-3aa50d8413.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

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

runTest {test tkt-3aa50d8413 {FillSchema with multiple result sets} -setup {
  setupDb [set fileName tkt-3aa50d8413.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  sql execute $db {
    CREATE TABLE t1(x);
    CREATE TABLE t2(x);
  }

  set sql { \
    SELECT * FROM t1; \
    SELECT * FROM t2; \
  }

  unset -nocomplain results errors

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

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

            using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(
                "${sql}", connection))
            {
              using (DataSet dataSet = new DataSet())
              {
                dataAdapter.FillSchema(dataSet, SchemaType.Source);
              }
            }
          }
        }
      }
    }
  }] 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} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

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

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

runSQLiteTestEpilogue
runTestEpilogue