Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add support for setting the default DbType and type name used for mappings on a per-connection basis. Pursuant to [3c00ec5b52]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
cf20301f892a7008f60451d7e71908be |
User & Date: | mistachkin 2014-05-14 20:14:34 |
References
2014-05-14
| ||
20:15 | • Closed ticket [3c00ec5b52]: Columns without defined type are not identified as text plus 5 other changes artifact: 6cc5e2f7d7 user: mistachkin | |
Context
2014-05-15
| ||
00:05 | Also support overriding the default DbType value and type name via a 'configuration setting' (i.e. via the environment or the DLL config file). check-in: 216889c23b user: mistachkin tags: trunk | |
2014-05-14
| ||
20:14 | Add support for setting the default DbType and type name used for mappings on a per-connection basis. Pursuant to [3c00ec5b52]. check-in: cf20301f89 user: mistachkin tags: trunk | |
20:13 | Add tests and update version history docs. Closed-Leaf check-in: c09a345694 user: mistachkin tags: tkt-3c00ec5b52 | |
2014-05-12
| ||
22:23 | Update the Visual C++ 2013 redistributable packages in externals to Visual Studio 2013 Update 2. check-in: cdce870cee user: mistachkin tags: trunk | |
Changes
Changes to Doc/Extra/Provider/version.html.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
<div id="mainSection"> <div id="mainBody"> <h1 class="heading">Version History</h1> <p><b>1.0.93.0 - June XX, 2014 <font color="red">(release scheduled)</font></b></p> <ul> <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_3.html">SQLite 3.8.4.3</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 SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].</li> <li>Make the ISQLiteSchemaExtensions interface public. <b>** Potentially Incompatible Change **</b></li> <li>Have the SQLiteProviderFactory class (in the System.Data.SQLite.Linq assembly) implement the IServiceProvider interface.</li> </ul> <p><b>1.0.92.0 - March 19, 2014</p> <ul> <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li> |
> |
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
<div id="mainSection">
<div id="mainBody">
<h1 class="heading">Version History</h1>
<p><b>1.0.93.0 - June XX, 2014 <font color="red">(release scheduled)</font></b></p>
<ul>
<li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_3.html">SQLite 3.8.4.3</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>
<li>Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].</li>
<li>Make the ISQLiteSchemaExtensions interface public. <b>** Potentially Incompatible Change **</b></li>
<li>Have the SQLiteProviderFactory class (in the System.Data.SQLite.Linq assembly) implement the IServiceProvider interface.</li>
</ul>
<p><b>1.0.92.0 - March 19, 2014</p>
<ul>
<li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li>
|
Changes to System.Data.SQLite/SQLiteConnection.cs.
469 470 471 472 473 474 475 476 477 478 479 480 481 482 ... 612 613 614 615 616 617 618 619 620 621 622 623 624 625 .... 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 .... 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 |
/// <summary> /// The extra behavioral flags for this connection, if any. See the /// <see cref="SQLiteConnectionFlags" /> enumeration for a list of /// possible values. /// </summary> private SQLiteConnectionFlags _flags; /// <summary> /// Default command timeout /// </summary> private int _defaultTimeout = 30; /// <summary> /// Non-zero if the built-in (i.e. framework provided) connection string ................................................................................ SQLiteErrorCode.Ok, SQLiteConvert.ToUTF8("logging initialized.")); } #endif _typeNames = new SQLiteDbTypeMap(); _parseViaFramework = parseViaFramework; _flags = SQLiteConnectionFlags.Default; _connectionState = ConnectionState.Closed; _connectionString = null; if (connectionString != null) ConnectionString = connectionString; } ................................................................................ null, _connectionString, new object[] { opts })); object enumValue; enumValue = TryParseEnum(typeof(SQLiteConnectionFlags), FindKey(opts, "Flags", DefaultFlags.ToString()), true); _flags = (enumValue is SQLiteConnectionFlags) ? (SQLiteConnectionFlags)enumValue : DefaultFlags; #if !NET_COMPACT_20 && TRACE_WARNING bool uri = false; #endif bool fullUri = false; string fileName; if (Convert.ToInt32(FindKey(opts, "Version", DefaultVersion.ToString()), CultureInfo.InvariantCulture) != DefaultVersion) ................................................................................ /// possible values. /// </summary> public SQLiteConnectionFlags Flags { get { CheckDisposed(); return _flags; } set { CheckDisposed(); _flags = value; } } /// <summary> /// Returns non-zero if the underlying native connection handle is /// owned by this instance. /// </summary> public bool OwnHandle { |
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 ... 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 .... 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 .... 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 |
/// <summary> /// The extra behavioral flags for this connection, if any. See the /// <see cref="SQLiteConnectionFlags" /> enumeration for a list of /// possible values. /// </summary> 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; /// <summary> /// Default command timeout /// </summary> private int _defaultTimeout = 30; /// <summary> /// Non-zero if the built-in (i.e. framework provided) connection string ................................................................................ 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; } ................................................................................ null, _connectionString, new object[] { opts })); object enumValue; enumValue = TryParseEnum(typeof(SQLiteConnectionFlags), FindKey(opts, "Flags", DefaultFlags.ToString()), true); _flags = (enumValue is SQLiteConnectionFlags) ? (SQLiteConnectionFlags)enumValue : DefaultFlags; 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; if (Convert.ToInt32(FindKey(opts, "Version", DefaultVersion.ToString()), CultureInfo.InvariantCulture) != DefaultVersion) ................................................................................ /// possible values. /// </summary> public SQLiteConnectionFlags Flags { get { CheckDisposed(); return _flags; } set { CheckDisposed(); _flags = value; } } /// <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 /// will only be used if the <see cref="SQLiteConnectionFlags.UseConnectionTypes" /> /// flag is set. /// </summary> public string DefaultTypeName { get { CheckDisposed(); return _defaultTypeName; } set { CheckDisposed(); _defaultTypeName = value; } } /// <summary> /// Returns non-zero if the underlying native connection handle is /// owned by this instance. /// </summary> public bool OwnHandle { |
Changes to System.Data.SQLite/SQLiteConvert.cs.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 ... 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 .... 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 .... 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 .... 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 |
using System.Text; /// <summary> /// This base class provides datatype conversion services for the SQLite provider. /// </summary> public abstract class SQLiteConvert { /// <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); /// <summary> ................................................................................ /// <returns>The type name or an empty string if it cannot be determined.</returns> internal static string DbTypeToTypeName( SQLiteConnection connection, DbType dbType, SQLiteConnectionFlags flags ) { if (connection != null) { flags |= connection.Flags; if ((flags & SQLiteConnectionFlags.UseConnectionTypes) == SQLiteConnectionFlags.UseConnectionTypes) { SQLiteDbTypeMap connectionTypeNames = connection._typeNames; ................................................................................ if (connectionTypeNames != null) { SQLiteDbTypeMapping value; if (connectionTypeNames.TryGetValue(dbType, out value)) return value.typeName; } } } string defaultTypeName = String.Empty; if ((flags & SQLiteConnectionFlags.NoGlobalTypes) == SQLiteConnectionFlags.NoGlobalTypes) return defaultTypeName; lock (_syncRoot) { if (_typeNames == null) _typeNames = GetSQLiteDbTypeMap(); ................................................................................ /// <returns>The .NET DBType the text evaluates to.</returns> internal static DbType TypeNameToDbType( SQLiteConnection connection, string name, SQLiteConnectionFlags flags ) { if (connection != null) { flags |= connection.Flags; if ((flags & SQLiteConnectionFlags.UseConnectionTypes) == SQLiteConnectionFlags.UseConnectionTypes) { SQLiteDbTypeMap connectionTypeNames = connection._typeNames; ................................................................................ connectionTypeNames.TryGetValue(name.Substring(0, index).TrimEnd(), out value)) { return value.dataType; } } } } } } DbType defaultDbType = DbType.Object; if ((flags & SQLiteConnectionFlags.NoGlobalTypes) == SQLiteConnectionFlags.NoGlobalTypes) return defaultDbType; lock (_syncRoot) { if (_typeNames == null) _typeNames = GetSQLiteDbTypeMap(); |
> > > > > > > > > > > > > > > > > > > < < > > > > > > > < < |
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 .... 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 .... 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 .... 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 .... 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 |
using System.Text; /// <summary> /// This base class provides datatype conversion services for the SQLite provider. /// </summary> public abstract class SQLiteConvert { /// <summary> /// The fallback default database type when one cannot be obtained from an /// existing connection instance. /// </summary> internal static readonly 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); /// <summary> ................................................................................ /// <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 = FallbackDefaultTypeName; if (connection != null) { flags |= connection.Flags; if ((flags & SQLiteConnectionFlags.UseConnectionTypes) == SQLiteConnectionFlags.UseConnectionTypes) { SQLiteDbTypeMap connectionTypeNames = connection._typeNames; ................................................................................ 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(); ................................................................................ /// <returns>The .NET DBType the text evaluates to.</returns> internal static DbType TypeNameToDbType( SQLiteConnection connection, string name, SQLiteConnectionFlags flags ) { DbType defaultDbType = FallbackDefaultDbType; if (connection != null) { flags |= connection.Flags; if ((flags & SQLiteConnectionFlags.UseConnectionTypes) == SQLiteConnectionFlags.UseConnectionTypes) { SQLiteDbTypeMap connectionTypeNames = connection._typeNames; ................................................................................ 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(); |
Added Tests/tkt-3c00ec5b52.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 |
############################################################################### # # tkt-3c00ec5b52.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-3c00ec5b52-1.1 {per-connection default types} -setup { setupDb [set fileName tkt-3c00ec5b52-1.1.db] "" "" "" UseConnectionTypes \ "DefaultDbType=String;DefaultTypeName=TEXT;" } -body { set connection [getDbConnection] set result [list] lappend result [object invoke -flags +NonPublic \ System.Data.SQLite.SQLiteConvert TypeNameToDbType $connection "" None] lappend result [object invoke -flags +NonPublic \ System.Data.SQLite.SQLiteConvert DbTypeToTypeName $connection Object None] set result } -cleanup { freeDbConnection unset -nocomplain result connection cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {String TEXT}} ############################################################################### runTest {test tkt-3c00ec5b52-1.2 {per-connection default types} -setup { setupDb [set fileName tkt-3c00ec5b52-1.2.db] "" "" "" UseConnectionTypes } -body { set connection [getDbConnection] set result [list] lappend result [object invoke -flags +NonPublic \ System.Data.SQLite.SQLiteConvert TypeNameToDbType $connection "" None] lappend result [object invoke -flags +NonPublic \ System.Data.SQLite.SQLiteConvert DbTypeToTypeName $connection Object None] set result } -cleanup { freeDbConnection unset -nocomplain result connection cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {Object {}}} ############################################################################### runTest {test tkt-3c00ec5b52-1.3 {per-connection default types} -setup { setupDb [set fileName tkt-3c00ec5b52-1.3.db] } -body { set connection [getDbConnection] set result [list] lappend result [object invoke -flags +NonPublic \ System.Data.SQLite.SQLiteConvert TypeNameToDbType $connection "" None] lappend result [object invoke -flags +NonPublic \ System.Data.SQLite.SQLiteConvert DbTypeToTypeName $connection Object None] set result } -cleanup { freeDbConnection unset -nocomplain result connection cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {Object {}}} ############################################################################### runSQLiteTestEpilogue runTestEpilogue |
Changes to readme.htm.
210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
<p> <b>1.0.93.0 - June XX, 2014 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_3.html">SQLite 3.8.4.3</a>.</li> <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].</li> <li>Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].</li> <li>Make the ISQLiteSchemaExtensions interface public. <b>** Potentially Incompatible Change **</b></li> <li>Have the SQLiteProviderFactory class (in the System.Data.SQLite.Linq assembly) implement the IServiceProvider interface.</li> </ul> <p> <b>1.0.92.0 - March 19, 2014</b> </p> |
> |
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
<p>
<b>1.0.93.0 - June XX, 2014 <font color="red">(release scheduled)</font></b>
</p>
<ul>
<li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_3.html">SQLite 3.8.4.3</a>.</li>
<li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].</li>
<li>Add support for setting the default DbType and type name used for mappings on a per-connection basis. Pursuant to [3c00ec5b52].</li>
<li>Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].</li>
<li>Make the ISQLiteSchemaExtensions interface public. <b>** Potentially Incompatible Change **</b></li>
<li>Have the SQLiteProviderFactory class (in the System.Data.SQLite.Linq assembly) implement the IServiceProvider interface.</li>
</ul>
<p>
<b>1.0.92.0 - March 19, 2014</b>
</p>
|
Changes to www/news.wiki.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<p> <b>1.0.93.0 - June XX, 2014 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_3.html">SQLite 3.8.4.3</a>.</li> <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].</li> <li>Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].</li> <li>Make the ISQLiteSchemaExtensions interface public. <b>** Potentially Incompatible Change **</b></li> <li>Have the SQLiteProviderFactory class (in the System.Data.SQLite.Linq assembly) implement the IServiceProvider interface.</li> </ul> <p> <b>1.0.92.0 - March 19, 2014</b> </p> |
> |
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<p>
<b>1.0.93.0 - June XX, 2014 <font color="red">(release scheduled)</font></b>
</p>
<ul>
<li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_3.html">SQLite 3.8.4.3</a>.</li>
<li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].</li>
<li>Add support for setting the default DbType and type name used for mappings on a per-connection basis. Pursuant to [3c00ec5b52].</li>
<li>Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].</li>
<li>Make the ISQLiteSchemaExtensions interface public. <b>** Potentially Incompatible Change **</b></li>
<li>Have the SQLiteProviderFactory class (in the System.Data.SQLite.Linq assembly) implement the IServiceProvider interface.</li>
</ul>
<p>
<b>1.0.92.0 - March 19, 2014</b>
</p>
|