Index: Doc/Extra/Provider/version.html
==================================================================
--- Doc/Extra/Provider/version.html
+++ Doc/Extra/Provider/version.html
@@ -46,11 +46,11 @@
1.0.93.0 - June XX, 2014 (release scheduled)
- Updated to SQLite 3.8.4.3.
- Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].
- Add support for setting the default DbType and type name used for mappings on a per-connection basis. Pursuant to [3c00ec5b52].
- - Add DetectTextAffinity connection flag to enable automatic detection of column affinities, when necessary. Pursuant to [3c00ec5b52].
+ - Add DetectTextAffinity and DetectStringType connection flags to enable automatic detection of column types, when necessary. Pursuant to [3c00ec5b52].
- Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].
- Make the ISQLiteSchemaExtensions interface public. ** Potentially Incompatible Change **
- Have the SQLiteProviderFactory class (in the System.Data.SQLite.Linq assembly) implement the IServiceProvider interface.
- Fix bug in documentation generator automation that prevented some internal documentation links from working.
Index: System.Data.SQLite/SQLiteBase.cs
==================================================================
--- System.Data.SQLite/SQLiteBase.cs
+++ System.Data.SQLite/SQLiteBase.cs
@@ -1065,18 +1065,28 @@
///
MapIsolationLevels = 0x1000000,
///
/// When returning column values, attempt to detect the affinity of
- /// textual values to see if they fully conform to those of the
+ /// textual values by checking if they fully conform to those of the
/// ,
/// ,
/// ,
/// or types.
///
DetectTextAffinity = 0x2000000,
+ ///
+ /// When returning column values, attempt to detect the type of
+ /// string values by checking if they fully conform to those of
+ /// the ,
+ /// ,
+ /// ,
+ /// or types.
+ ///
+ DetectStringType = 0x4000000,
+
///
/// When binding parameter values or returning column values, always
/// treat them as though they were plain text (i.e. no numeric,
/// date/time, or other conversions should be attempted).
///
Index: System.Data.SQLite/SQLiteConvert.cs
==================================================================
--- System.Data.SQLite/SQLiteConvert.cs
+++ System.Data.SQLite/SQLiteConvert.cs
@@ -1315,10 +1315,36 @@
new SQLiteDbTypeMapping("VARCHAR", DbType.AnsiString, true),
new SQLiteDbTypeMapping("VARCHAR2", DbType.AnsiString, false),
new SQLiteDbTypeMapping("YESNO", DbType.Boolean, false)
});
}
+
+ ///
+ /// Determines if a database type is considered to be a string.
+ ///
+ ///
+ /// The database type to check.
+ ///
+ ///
+ /// Non-zero if the database type is considered to be a string, zero
+ /// otherwise.
+ ///
+ internal static bool IsStringDbType(
+ DbType type
+ )
+ {
+ switch (type)
+ {
+ case DbType.AnsiString:
+ case DbType.String:
+ case DbType.AnsiStringFixedLength:
+ case DbType.StringFixedLength:
+ return true;
+ default:
+ return false;
+ }
+ }
///
/// Determines the default value to be used when a
/// per-connection value is not available.
///
Index: System.Data.SQLite/SQLiteDataReader.cs
==================================================================
--- System.Data.SQLite/SQLiteDataReader.cs
+++ System.Data.SQLite/SQLiteDataReader.cs
@@ -989,14 +989,12 @@
{
dataType = arSize[0];
arSize = arSize[1].Split(')');
if (arSize.Length > 1)
{
- arSize = arSize[0].Split(',', '.');
- if (sqlType.Type == DbType.AnsiString || sqlType.Type == DbType.Binary ||
- sqlType.Type == DbType.String || sqlType.Type == DbType.AnsiStringFixedLength ||
- sqlType.Type == DbType.StringFixedLength)
+ arSize = arSize[0].Split(',', '.');
+ if (sqlType.Type == DbType.Binary || SQLiteConvert.IsStringDbType(sqlType.Type))
{
row[SchemaTableColumn.ColumnSize] = Convert.ToInt32(arSize[0], CultureInfo.InvariantCulture);
}
else
{
@@ -1141,10 +1139,16 @@
if (((flags & SQLiteConnectionFlags.DetectTextAffinity) == SQLiteConnectionFlags.DetectTextAffinity) &&
((typ == null) || (typ.Affinity == TypeAffinity.Text)))
{
typ = GetSQLiteType(
typ, _activeStatement._sql.GetText(_activeStatement, i));
+ }
+ else if (((flags & SQLiteConnectionFlags.DetectStringType) == SQLiteConnectionFlags.DetectStringType) &&
+ ((typ == null) || SQLiteConvert.IsStringDbType(typ.Type)))
+ {
+ typ = GetSQLiteType(
+ typ, _activeStatement._sql.GetText(_activeStatement, i));
}
return _activeStatement._sql.GetValue(_activeStatement, flags, i, typ);
}
Index: readme.htm
==================================================================
--- readme.htm
+++ readme.htm
@@ -213,11 +213,11 @@
- Updated to SQLite 3.8.4.3.
- Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].
- Add support for setting the default DbType and type name used for mappings on a per-connection basis. Pursuant to [3c00ec5b52].
- - Add DetectTextAffinity connection flag to enable automatic detection of column affinities, when necessary. Pursuant to [3c00ec5b52].
+ - Add DetectTextAffinity and DetectStringType connection flags to enable automatic detection of column types, when necessary. Pursuant to [3c00ec5b52].
- Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].
- Make the ISQLiteSchemaExtensions interface public. ** Potentially Incompatible Change **
- Have the SQLiteProviderFactory class (in the System.Data.SQLite.Linq assembly) implement the IServiceProvider interface.
- Fix bug in documentation generator automation that prevented some internal documentation links from working.
Index: www/news.wiki
==================================================================
--- www/news.wiki
+++ www/news.wiki
@@ -7,11 +7,11 @@
- Updated to SQLite 3.8.4.3.
- Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].
- Add support for setting the default DbType and type name used for mappings on a per-connection basis. Pursuant to [3c00ec5b52].
- - Add DetectTextAffinity connection flag to enable automatic detection of column affinities, when necessary. Pursuant to [3c00ec5b52].
+ - Add DetectTextAffinity and DetectStringType connection flags to enable automatic detection of column types, when necessary. Pursuant to [3c00ec5b52].
- Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].
- Make the ISQLiteSchemaExtensions interface public. ** Potentially Incompatible Change **
- Have the SQLiteProviderFactory class (in the System.Data.SQLite.Linq assembly) implement the IServiceProvider interface.
- Fix bug in documentation generator automation that prevented some internal documentation links from working.