System.Data.SQLite
Check-in [69065c8e3b]
Not logged in

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

Overview
Comment:Minimize usage of the 'Use_SQLiteConvert_DefaultDbType' and 'Use_SQLiteConvert_DefaultTypeName' settings. Fix for [58ed318f2f].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 69065c8e3b1d7571a662299d9c2f8ffcc74f4b04
User & Date: mistachkin 2014-07-30 00:39:57
References
2014-07-30
00:40 Closed ticket [58ed318f2f]: GetValue hits the xml config file every time plus 5 other changes artifact: 8cb30bcfbc user: mistachkin
Context
2014-07-31
05:48
Cleanup the NuGet package configuration transform files. check-in: b4069b4c09 user: mistachkin tags: trunk
2014-07-30
00:39
Minimize usage of the 'Use_SQLiteConvert_DefaultDbType' and 'Use_SQLiteConvert_DefaultTypeName' settings. Fix for [58ed318f2f]. check-in: 69065c8e3b user: mistachkin tags: trunk
2014-07-29
22:48
For the debug build configuration only, keep track of how many times each runtime configuration setting is read and have the test suite report on same. Pursuant to [58ed318f2f]. check-in: d0e28511f3 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Doc/Extra/Provider/version.html.

41
42
43
44
45
46
47

48
49

50
51
52
53
54
55
56
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.94.0 - August XX, 2014 <font color="red">(release scheduled)</font></b></p>
    <ul>

      <li>Add RefreshFlags method to the SQLiteDataReader class to forcibly refresh its connection flags.</li>
      <li>Improve SQLiteDataReader performance slightly by caching the connection flags.&nbsp;<b>** Potentially Incompatible Change **</b></li>

    </ul>
    <p><b>1.0.93.0 - June 23, 2014</b></p>
    <ul>
      <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_5.html">SQLite 3.8.5</a>.</li>
      <li>Updated to <a href="http://www.nuget.org/packages/EntityFramework/6.1">Entity Framework 6.1</a>.</li>
      <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to <a href="http://system.data.sqlite.org/index.html/info/56b42d99c1">[56b42d99c1]</a>.</li>
      <li>Add support for setting the default DbType and type name used for mappings on a per-connection basis. Pursuant to <a href="http://system.data.sqlite.org/index.html/info/3c00ec5b52">[3c00ec5b52]</a>.</li>







>


>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.94.0 - August XX, 2014 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="http://www.nuget.org/packages/EntityFramework/6.1.1">Entity Framework 6.1.1</a>.</li>
      <li>Add RefreshFlags method to the SQLiteDataReader class to forcibly refresh its connection flags.</li>
      <li>Improve SQLiteDataReader performance slightly by caching the connection flags.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Minimize usage of the &quot;Use_SQLiteConvert_DefaultDbType&quot; and &quot;Use_SQLiteConvert_DefaultTypeName&quot; settings. Fix for <a href="http://system.data.sqlite.org/index.html/info/58ed318f2f">[58ed318f2f]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    </ul>
    <p><b>1.0.93.0 - June 23, 2014</b></p>
    <ul>
      <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_5.html">SQLite 3.8.5</a>.</li>
      <li>Updated to <a href="http://www.nuget.org/packages/EntityFramework/6.1">Entity Framework 6.1</a>.</li>
      <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to <a href="http://system.data.sqlite.org/index.html/info/56b42d99c1">[56b42d99c1]</a>.</li>
      <li>Add support for setting the default DbType and type name used for mappings on a per-connection basis. Pursuant to <a href="http://system.data.sqlite.org/index.html/info/3c00ec5b52">[3c00ec5b52]</a>.</li>

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

480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
...
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
....
1926
1927
1928
1929
1930
1931
1932


1933
1934
1935
1936
1937
1938
1939

1940
1941
1942
1943
1944
1945
1946
....
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
....
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
    private SQLiteConnectionFlags _flags;

    /// <summary>
    /// The default databse type for this connection.  This value will only
    /// be used if the <see cref="SQLiteConnectionFlags.UseConnectionTypes" />
    /// flag is set.
    /// </summary>
    private DbType _defaultDbType;

    /// <summary>
    /// The default databse type name for this connection.  This value will only
    /// be used if the <see cref="SQLiteConnectionFlags.UseConnectionTypes" />
    /// flag is set.
    /// </summary>
    private string _defaultTypeName;
................................................................................
              SQLiteErrorCode.Ok, SQLiteConvert.ToUTF8("logging initialized."));
      }
#endif

      _typeNames = new SQLiteDbTypeMap();
      _parseViaFramework = parseViaFramework;
      _flags = SQLiteConnectionFlags.Default;
      _defaultDbType = SQLiteConvert.FallbackDefaultDbType;
      _defaultTypeName = SQLiteConvert.FallbackDefaultTypeName;
      _connectionState = ConnectionState.Closed;
      _connectionString = null;

      if (connectionString != null)
        ConnectionString = connectionString;
    }

................................................................................
    /// <returns>The enumerated value upon success or null upon error.</returns>
    internal static object TryParseEnum(
        Type type,
        string value,
        bool ignoreCase
        )
    {


        try
        {
            return Enum.Parse(type, value, ignoreCase);
        }
        catch
        {
            // do nothing.

        }

        return null;
    }

    /// <summary>
    /// Attempts to convert an input string into a byte value.
................................................................................

      enumValue = TryParseEnum(typeof(SQLiteConnectionFlags), FindKey(opts, "Flags", DefaultFlags.ToString()), true);
      _flags = (enumValue is SQLiteConnectionFlags) ? (SQLiteConnectionFlags)enumValue : DefaultFlags;

      bool noSharedFlags = SQLiteConvert.ToBoolean(FindKey(opts, "NoSharedFlags", DefaultNoSharedFlags.ToString()));
      if (!noSharedFlags) { lock (_syncRoot) { _flags |= _sharedFlags; } }

      enumValue = TryParseEnum(typeof(DbType), FindKey(opts, "DefaultDbType", SQLiteConvert.FallbackDefaultDbType.ToString()), true);
      _defaultDbType = (enumValue is DbType) ? (DbType)enumValue : SQLiteConvert.FallbackDefaultDbType;
      _defaultTypeName = FindKey(opts, "DefaultTypeName", SQLiteConvert.FallbackDefaultTypeName);

#if !NET_COMPACT_20 && TRACE_WARNING
      bool uri = false;
#endif
      bool fullUri = false;
      string fileName;

................................................................................
    }

    /// <summary>
    /// Gets/sets the default database type for this connection.  This value
    /// will only be used if the <see cref="SQLiteConnectionFlags.UseConnectionTypes" />
    /// flag is set.
    /// </summary>
    public DbType DefaultDbType
    {
      get { CheckDisposed(); return _defaultDbType; }
      set { CheckDisposed(); _defaultDbType = value; }
    }

    /// <summary>
    /// Gets/sets the default database type name for this connection.  This value







|







 







|
|







 







>
>
|
|
|
|
|
|
|
>







 







|
|
|







 







|







480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
...
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
....
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
....
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
....
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
    private SQLiteConnectionFlags _flags;

    /// <summary>
    /// The default databse type for this connection.  This value will only
    /// be used if the <see cref="SQLiteConnectionFlags.UseConnectionTypes" />
    /// flag is set.
    /// </summary>
    private DbType? _defaultDbType;

    /// <summary>
    /// The default databse type name for this connection.  This value will only
    /// be used if the <see cref="SQLiteConnectionFlags.UseConnectionTypes" />
    /// flag is set.
    /// </summary>
    private string _defaultTypeName;
................................................................................
              SQLiteErrorCode.Ok, SQLiteConvert.ToUTF8("logging initialized."));
      }
#endif

      _typeNames = new SQLiteDbTypeMap();
      _parseViaFramework = parseViaFramework;
      _flags = SQLiteConnectionFlags.Default;
      _defaultDbType = null;
      _defaultTypeName = null;
      _connectionState = ConnectionState.Closed;
      _connectionString = null;

      if (connectionString != null)
        ConnectionString = connectionString;
    }

................................................................................
    /// <returns>The enumerated value upon success or null upon error.</returns>
    internal static object TryParseEnum(
        Type type,
        string value,
        bool ignoreCase
        )
    {
        if (!String.IsNullOrEmpty(value))
        {
            try
            {
                return Enum.Parse(type, value, ignoreCase);
            }
            catch
            {
                // do nothing.
            }
        }

        return null;
    }

    /// <summary>
    /// Attempts to convert an input string into a byte value.
................................................................................

      enumValue = TryParseEnum(typeof(SQLiteConnectionFlags), FindKey(opts, "Flags", DefaultFlags.ToString()), true);
      _flags = (enumValue is SQLiteConnectionFlags) ? (SQLiteConnectionFlags)enumValue : DefaultFlags;

      bool noSharedFlags = SQLiteConvert.ToBoolean(FindKey(opts, "NoSharedFlags", DefaultNoSharedFlags.ToString()));
      if (!noSharedFlags) { lock (_syncRoot) { _flags |= _sharedFlags; } }

      enumValue = TryParseEnum(typeof(DbType), FindKey(opts, "DefaultDbType", null), true);
      _defaultDbType = (enumValue is DbType) ? (DbType)enumValue : (DbType?)null;
      _defaultTypeName = FindKey(opts, "DefaultTypeName", null);

#if !NET_COMPACT_20 && TRACE_WARNING
      bool uri = false;
#endif
      bool fullUri = false;
      string fileName;

................................................................................
    }

    /// <summary>
    /// Gets/sets the default database type for this connection.  This value
    /// will only be used if the <see cref="SQLiteConnectionFlags.UseConnectionTypes" />
    /// flag is set.
    /// </summary>
    public DbType? DefaultDbType
    {
      get { CheckDisposed(); return _defaultDbType; }
      set { CheckDisposed(); _defaultDbType = value; }
    }

    /// <summary>
    /// Gets/sets the default database type name for this connection.  This value

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

606
607
608
609
610
611
612
613
614
615
616
617
618

619

620
621
622


623



624
625
626
627
628
629
630
    }

    /// <summary>
    /// Gets/sets the default database type for the connection.
    /// </summary>
    [DisplayName("Default Database Type")]
    [Browsable(true)]
    [DefaultValue(SQLiteConvert.FallbackDefaultDbType)]
    public DbType DefaultDbType
    {
        get
        {
            object value;

            TryGetValue("defaultdbtype", out value);

            if (value is string)
                return (DbType)TypeDescriptor.GetConverter(typeof(DbType)).ConvertFrom(value);
            else


                return (DbType)value;



        }
        set
        {
            this["defaultdbtype"] = value;
        }
    }








|
|




>
|
>
|
|
<
>
>
|
>
>
>







606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623

624
625
626
627
628
629
630
631
632
633
634
635
636
    }

    /// <summary>
    /// Gets/sets the default database type for the connection.
    /// </summary>
    [DisplayName("Default Database Type")]
    [Browsable(true)]
    [DefaultValue(null)]
    public DbType? DefaultDbType
    {
        get
        {
            object value;

            if (TryGetValue("defaultdbtype", out value))
            {
                if (value is string)
                    return (DbType)TypeDescriptor.GetConverter(

                        typeof(DbType)).ConvertFrom(value);
                else if (value != null)
                    return (DbType)value;
            }

            return null;
        }
        set
        {
            this["defaultdbtype"] = value;
        }
    }

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

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
....
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
....
1135
1136
1137
1138
1139
1140
1141
1142

1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
....
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
....
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
....
1571
1572
1573
1574
1575
1576
1577
1578

1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
....
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
  /// </summary>
  public abstract class SQLiteConvert
  {
    /// <summary>
    /// The fallback default database type when one cannot be obtained from an
    /// existing connection instance.
    /// </summary>
    internal const DbType FallbackDefaultDbType = DbType.Object;

    /// <summary>
    /// The fallback default database type name when one cannot be obtained from
    /// an existing connection instance.
    /// </summary>
    internal static readonly string FallbackDefaultTypeName = String.Empty;

    /// <summary>
    /// The value for the Unix epoch (e.g. January 1, 1970 at midnight, in UTC).
    /// </summary>
    protected static readonly DateTime UnixEpoch =
        new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

................................................................................
    /// <returns>The type name or an empty string if it cannot be determined.</returns>
    internal static string DbTypeToTypeName(
        SQLiteConnection connection,
        DbType dbType,
        SQLiteConnectionFlags flags
        )
    {
        string defaultTypeName = GetDefaultTypeName();

        if (connection != null)
        {
            flags |= connection.Flags;

            if ((flags & SQLiteConnectionFlags.UseConnectionTypes) == SQLiteConnectionFlags.UseConnectionTypes)
            {
................................................................................
                if (connectionTypeNames != null)
                {
                    SQLiteDbTypeMapping value;

                    if (connectionTypeNames.TryGetValue(dbType, out value))
                        return value.typeName;
                }


                //
                // NOTE: Use the default database type name for the connection.
                //
                defaultTypeName = connection.DefaultTypeName;
            }
        }

        if ((flags & SQLiteConnectionFlags.NoGlobalTypes) == SQLiteConnectionFlags.NoGlobalTypes)
            return defaultTypeName;

        lock (_syncRoot)
        {
            if (_typeNames == null)
                _typeNames = GetSQLiteDbTypeMap();

            SQLiteDbTypeMapping value;
................................................................................
            Trace.WriteLine(String.Format(
                CultureInfo.CurrentCulture,
                "WARNING: Type mapping failed, returning default name \"{0}\" for type {1}.",
                defaultTypeName, dbType));
        }
#endif

        return defaultTypeName;
    }

    /// <summary>
    /// Convert a DbType to a Type
    /// </summary>
    /// <param name="typ">The DbType to convert from</param>
    /// <returns>The closest-match .NET type</returns>
................................................................................
    /// <returns>The .NET DBType the text evaluates to.</returns>
    internal static DbType TypeNameToDbType(
        SQLiteConnection connection,
        string name,
        SQLiteConnectionFlags flags
        )
    {
        DbType defaultDbType = GetDefaultDbType();

        if (connection != null)
        {
            flags |= connection.Flags;

            if ((flags & SQLiteConnectionFlags.UseConnectionTypes) == SQLiteConnectionFlags.UseConnectionTypes)
            {
................................................................................
                                connectionTypeNames.TryGetValue(name.Substring(0, index).TrimEnd(), out value))
                            {
                                return value.dataType;
                            }
                        }
                    }
                }


                //
                // NOTE: Use the default database type for the connection.
                //
                defaultDbType = connection.DefaultDbType;
            }
        }

        if ((flags & SQLiteConnectionFlags.NoGlobalTypes) == SQLiteConnectionFlags.NoGlobalTypes)
            return defaultDbType;

        lock (_syncRoot)
        {
            if (_typeNames == null)
                _typeNames = GetSQLiteDbTypeMap();

            if (name != null)
................................................................................
            Trace.WriteLine(String.Format(
                CultureInfo.CurrentCulture,
                "WARNING: Type mapping failed, returning default type {0} for name \"{1}\".",
                defaultDbType, name));
        }
#endif

        return defaultDbType;
    }
    #endregion

    private static object _syncRoot = new object();
    private static SQLiteDbTypeMap _typeNames = null;
  }








|





|







 







|







 







|
>
|
|
|
|
<



|







 







|







 







|







 







|
>
|
|
|
|
<



|







 







|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
....
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
....
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147

1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
....
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
....
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
....
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583

1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
....
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
  /// </summary>
  public abstract class SQLiteConvert
  {
    /// <summary>
    /// The fallback default database type when one cannot be obtained from an
    /// existing connection instance.
    /// </summary>
    private const DbType FallbackDefaultDbType = DbType.Object;

    /// <summary>
    /// The fallback default database type name when one cannot be obtained from
    /// an existing connection instance.
    /// </summary>
    private static readonly string FallbackDefaultTypeName = String.Empty;

    /// <summary>
    /// The value for the Unix epoch (e.g. January 1, 1970 at midnight, in UTC).
    /// </summary>
    protected static readonly DateTime UnixEpoch =
        new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

................................................................................
    /// <returns>The type name or an empty string if it cannot be determined.</returns>
    internal static string DbTypeToTypeName(
        SQLiteConnection connection,
        DbType dbType,
        SQLiteConnectionFlags flags
        )
    {
        string defaultTypeName = null;

        if (connection != null)
        {
            flags |= connection.Flags;

            if ((flags & SQLiteConnectionFlags.UseConnectionTypes) == SQLiteConnectionFlags.UseConnectionTypes)
            {
................................................................................
                if (connectionTypeNames != null)
                {
                    SQLiteDbTypeMapping value;

                    if (connectionTypeNames.TryGetValue(dbType, out value))
                        return value.typeName;
                }
            }

            //
            // NOTE: Use the default database type name for the connection.
            //
            defaultTypeName = connection.DefaultTypeName;

        }

        if ((flags & SQLiteConnectionFlags.NoGlobalTypes) == SQLiteConnectionFlags.NoGlobalTypes)
            return (defaultTypeName != null) ? defaultTypeName : GetDefaultTypeName();

        lock (_syncRoot)
        {
            if (_typeNames == null)
                _typeNames = GetSQLiteDbTypeMap();

            SQLiteDbTypeMapping value;
................................................................................
            Trace.WriteLine(String.Format(
                CultureInfo.CurrentCulture,
                "WARNING: Type mapping failed, returning default name \"{0}\" for type {1}.",
                defaultTypeName, dbType));
        }
#endif

        return (defaultTypeName != null) ? defaultTypeName : GetDefaultTypeName();
    }

    /// <summary>
    /// Convert a DbType to a Type
    /// </summary>
    /// <param name="typ">The DbType to convert from</param>
    /// <returns>The closest-match .NET type</returns>
................................................................................
    /// <returns>The .NET DBType the text evaluates to.</returns>
    internal static DbType TypeNameToDbType(
        SQLiteConnection connection,
        string name,
        SQLiteConnectionFlags flags
        )
    {
        DbType? defaultDbType = null;

        if (connection != null)
        {
            flags |= connection.Flags;

            if ((flags & SQLiteConnectionFlags.UseConnectionTypes) == SQLiteConnectionFlags.UseConnectionTypes)
            {
................................................................................
                                connectionTypeNames.TryGetValue(name.Substring(0, index).TrimEnd(), out value))
                            {
                                return value.dataType;
                            }
                        }
                    }
                }
            }

            //
            // NOTE: Use the default database type for the connection.
            //
            defaultDbType = connection.DefaultDbType;

        }

        if ((flags & SQLiteConnectionFlags.NoGlobalTypes) == SQLiteConnectionFlags.NoGlobalTypes)
            return (defaultDbType != null) ? (DbType)defaultDbType : GetDefaultDbType();

        lock (_syncRoot)
        {
            if (_typeNames == null)
                _typeNames = GetSQLiteDbTypeMap();

            if (name != null)
................................................................................
            Trace.WriteLine(String.Format(
                CultureInfo.CurrentCulture,
                "WARNING: Type mapping failed, returning default type {0} for name \"{1}\".",
                defaultDbType, name));
        }
#endif

        return (defaultDbType != null) ? (DbType)defaultDbType : GetDefaultDbType();
    }
    #endregion

    private static object _syncRoot = new object();
    private static SQLiteDbTypeMap _typeNames = null;
  }

Added Tests/tkt-58ed318f2f.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
###############################################################################
#
# tkt-58ed318f2f.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

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

reportSQLiteResources $test_channel true

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

proc getSettingReadCount { name } {
  if {[haveConstraint buildConfiguration.Debug] && [catch {
    object invoke -flags +NonPublic -alias \
        System.Data.SQLite.UnsafeNativeMethods settingReadCounts
  } settingReadCounts] == 0} then {
    if {[$settingReadCounts TryGetValue $name value]} then {
      tputs $::test_channel [appendArgs \
          "---- setting \"" $name "\" was read " $value " times\n"]

      return $value
    }
  }

  tputs $::test_channel [appendArgs \
      "---- setting \"" $name "\" was not read\n"]

  return -1
}

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

runTest {test tkt-58ed318f2f-1.1 {standard GetDefaultDbType usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  sql execute -execute reader -format list $db "SELECT x, y FROM t1;"
  expr {[getSettingReadCount Use_SQLiteConvert_DefaultDbType] == 2}
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite\
buildConfiguration.Debug} -result {True}}

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

reportSQLiteResources $test_channel true

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

runTest {test tkt-58ed318f2f-1.2 {no property GetDefaultDbType usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.2.db] "" "" "" UseConnectionTypes
} -body {
  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  sql execute -execute reader -format list $db "SELECT x, y FROM t1;"
  expr {[getSettingReadCount Use_SQLiteConvert_DefaultDbType] == 2}
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite\
buildConfiguration.Debug} -result {True}}

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

reportSQLiteResources $test_channel true

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

runTest {test tkt-58ed318f2f-1.3 {no flag GetDefaultDbType usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.3.db] "" "" "" "" \
      "DefaultDbType=String;"
} -body {
  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  sql execute -execute reader -format list $db "SELECT x, y FROM t1;"
  expr {[getSettingReadCount Use_SQLiteConvert_DefaultDbType] == -1}
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite\
buildConfiguration.Debug} -result {True}}

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

reportSQLiteResources $test_channel true

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

runTest {test tkt-58ed318f2f-1.4 {zero GetDefaultDbType usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.4.db] "" "" "" UseConnectionTypes \
      "DefaultDbType=String;"
} -body {
  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  sql execute -execute reader -format list $db "SELECT x, y FROM t1;"
  expr {[getSettingReadCount Use_SQLiteConvert_DefaultDbType] == -1}
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite\
buildConfiguration.Debug} -result {True}}

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

rename getSettingReadCount ""

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

reportSQLiteResources $test_channel true

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

runSQLiteTestEpilogue
runTestEpilogue

Changes to readme.htm.

208
209
210
211
212
213
214

215
216

217
218
219
220
221
222
223

<h2><b>Version History</b></h2>

<p>
    <b>1.0.94.0 - August XX, 2014 <font color="red">(release scheduled)</font></b>
</p>
<ul>

    <li>Add RefreshFlags method to the SQLiteDataReader class to forcibly refresh its connection flags.</li>
    <li>Improve SQLiteDataReader performance slightly by caching the connection flags.&nbsp;<b>** Potentially Incompatible Change **</b></li>

</ul>
<p>
    <b>1.0.93.0 - June 23, 2014</b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_5.html">SQLite 3.8.5</a>.</li>
    <li>Updated to <a href="http://www.nuget.org/packages/EntityFramework/6.1">Entity Framework 6.1</a>.</li>







>


>







208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225

<h2><b>Version History</b></h2>

<p>
    <b>1.0.94.0 - August XX, 2014 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="http://www.nuget.org/packages/EntityFramework/6.1.1">Entity Framework 6.1.1</a>.</li>
    <li>Add RefreshFlags method to the SQLiteDataReader class to forcibly refresh its connection flags.</li>
    <li>Improve SQLiteDataReader performance slightly by caching the connection flags.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Minimize usage of the &quot;Use_SQLiteConvert_DefaultDbType&quot; and &quot;Use_SQLiteConvert_DefaultTypeName&quot; settings. Fix for [58ed318f2f].&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.93.0 - June 23, 2014</b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_5.html">SQLite 3.8.5</a>.</li>
    <li>Updated to <a href="http://www.nuget.org/packages/EntityFramework/6.1">Entity Framework 6.1</a>.</li>

Changes to www/news.wiki.

2
3
4
5
6
7
8

9
10

11
12
13
14
15
16
17

<b>Version History</b>

<p>
    <b>1.0.94.0 - August XX, 2014</b>
</p>
<ul>

    <li>Add RefreshFlags method to the SQLiteDataReader class to forcibly refresh its connection flags.</li>
    <li>Improve SQLiteDataReader performance slightly by caching the connection flags.&nbsp;<b>** Potentially Incompatible Change **</b></li>

</ul>
<p>
    <b>1.0.93.0 - June 23, 2014</b>
</p>
<ul>
    <li>Updated to [http://www.sqlite.org/releaselog/3_8_5.html|SQLite 3.8.5].</li>
    <li>Updated to [http://www.nuget.org/packages/EntityFramework/6.1|Entity Framework 6.1].</li>







>


>







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

<b>Version History</b>

<p>
    <b>1.0.94.0 - August XX, 2014</b>
</p>
<ul>
    <li>Updated to <a href="http://www.nuget.org/packages/EntityFramework/6.1.1">Entity Framework 6.1.1</a>.</li>
    <li>Add RefreshFlags method to the SQLiteDataReader class to forcibly refresh its connection flags.</li>
    <li>Improve SQLiteDataReader performance slightly by caching the connection flags.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Minimize usage of the &quot;Use_SQLiteConvert_DefaultDbType&quot; and &quot;Use_SQLiteConvert_DefaultTypeName&quot; settings. Fix for [58ed318f2f].&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.93.0 - June 23, 2014</b>
</p>
<ul>
    <li>Updated to [http://www.sqlite.org/releaselog/3_8_5.html|SQLite 3.8.5].</li>
    <li>Updated to [http://www.nuget.org/packages/EntityFramework/6.1|Entity Framework 6.1].</li>