Index: Doc/Extra/version.html
==================================================================
--- Doc/Extra/version.html
+++ Doc/Extra/version.html
@@ -57,11 +57,11 @@
Support custom connection pool implementations by adding the ISQLiteConnectionPool interface, the static SQLiteConnection.ConnectionPool property, and the static CreateHandle method in addition to modifying the SQLiteConnectionPool class. Pursuant to [393d954be0].
Add public constructor to the SQLiteDataAdapter class that allows passing the parseViaFramework parameter to the SQLiteConnection constructor.
When built with the CHECK_STATE compile-time option, skip throwing exceptions from the SQLiteDataReader class when the object is being disposed.
Support automatic value conversions for columns with a declared type of BIGUINT, INTEGER8, INTEGER16, INTEGER32, INTEGER64, SMALLUINT, TINYSINT, UNSIGNEDINTEGER, UNSIGNEDINTEGER8, UNSIGNEDINTEGER16, UNSIGNEDINTEGER32, UNSIGNEDINTEGER64, INT8, INT16, INT32, INT64, UINT, UINT8, UINT16, UINT32, UINT64, or ULONG.
Add BindUInt32AsInt64 connection flag to force binding of UInt32 values as Int64 instead. Pursuant to [c010fa6584].
- Add BindAllAsText connection flag to force binding of all values as text.
+ Add BindAllAsText and GetAllAsText connection flags to force binding and returning of all values as text.
Remove AUTOINCREMENT from the column type name map. ** Potentially Incompatible Change **
Avoid throwing overflow exceptions from the SQLite3.GetValue method for integral column types. Partial fix for [c010fa6584]. ** Potentially Incompatible Change **
Use the legacy connection closing algorithm when built with the INTEROP_LEGACY_CLOSE compile-time option.
Support using the directory containing the primary managed-only assembly as the basis for native library pre-loading.
Still further enhancements to the build and test automation.
Index: System.Data.SQLite/SQLite3.cs
==================================================================
--- System.Data.SQLite/SQLite3.cs
+++ System.Data.SQLite/SQLite3.cs
@@ -1915,14 +1915,15 @@
///
/// Helper function to retrieve a column of data from an active statement.
///
/// The statement being step()'d through
+ /// The flags associated with the connection.
/// The column index to retrieve
/// The type of data contained in the column. If Uninitialized, this function will retrieve the datatype information.
/// Returns the data in the column
- internal override object GetValue(SQLiteStatement stmt, int index, SQLiteType typ)
+ internal override object GetValue(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, SQLiteType typ)
{
if (IsNull(stmt, index)) return DBNull.Value;
TypeAffinity aff = typ.Affinity;
Type t = null;
@@ -1929,10 +1930,13 @@
if (typ.Type != DbType.Object)
{
t = SQLiteConvert.SQLiteTypeToType(typ);
aff = TypeToAffinity(t);
}
+
+ if ((flags & SQLiteConnectionFlags.GetAllAsText) == SQLiteConnectionFlags.GetAllAsText)
+ return GetText(stmt, index);
switch (aff)
{
case TypeAffinity.Blob:
if (typ.Type == DbType.Guid && typ.Affinity == TypeAffinity.Text)
Index: System.Data.SQLite/SQLiteBase.cs
==================================================================
--- System.Data.SQLite/SQLiteBase.cs
+++ System.Data.SQLite/SQLiteBase.cs
@@ -269,11 +269,11 @@
internal abstract bool IsInitialized();
internal abstract int GetCursorForTable(SQLiteStatement stmt, int database, int rootPage);
internal abstract long GetRowIdForCursor(SQLiteStatement stmt, int cursor);
- internal abstract object GetValue(SQLiteStatement stmt, int index, SQLiteType typ);
+ internal abstract object GetValue(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, SQLiteType typ);
internal abstract bool AutoCommit
{
get;
}
@@ -796,10 +796,24 @@
/// plain text (i.e. no numeric, date/time, or other conversions should
/// be attempted).
///
BindAllAsText = 0x80,
+ ///
+ /// When returning column values, always return them as though they were
+ /// plain text (i.e. no numeric, date/time, or other conversions should
+ /// be attempted).
+ ///
+ GetAllAsText = 0x100,
+
+ ///
+ /// When binding and returning column values, always treat them as though
+ /// they were plain text (i.e. no numeric, date/time, or other conversions
+ /// should be attempted).
+ ///
+ BindAndGetAllAsText = BindAllAsText | GetAllAsText,
+
///
/// Enable all logging.
///
LogAll = LogPrepare | LogPreBind | LogBind |
LogCallbackException | LogBackup,
Index: System.Data.SQLite/SQLiteCommand.cs
==================================================================
--- System.Data.SQLite/SQLiteCommand.cs
+++ System.Data.SQLite/SQLiteCommand.cs
@@ -232,10 +232,45 @@
{
base.Dispose(disposing);
}
}
#endregion
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ ///
+ /// This method attempts to query the flags associated with the database
+ /// connection in use. If the database connection is disposed or any other
+ /// error occurs, the default flags will be returned.
+ ///
+ ///
+ /// The command containing the databse connection to query the flags from.
+ ///
+ ///
+ /// The connection flags value.
+ ///
+ internal static SQLiteConnectionFlags GetFlags(
+ SQLiteCommand command
+ )
+ {
+ try
+ {
+ if (command != null)
+ {
+ SQLiteConnection cnn = command._cnn;
+
+ if (cnn != null)
+ return cnn.Flags;
+ }
+ }
+ catch (ObjectDisposedException)
+ {
+ // do nothing.
+ }
+
+ return SQLiteConnectionFlags.Default;
+ }
///////////////////////////////////////////////////////////////////////////////////////////////
///
/// Clears and destroys all statements currently prepared
Index: System.Data.SQLite/SQLiteDataReader.cs
==================================================================
--- System.Data.SQLite/SQLiteDataReader.cs
+++ System.Data.SQLite/SQLiteDataReader.cs
@@ -1122,11 +1122,12 @@
if (i >= VisibleFieldCount && _keyInfo != null)
return _keyInfo.GetValue(i - VisibleFieldCount);
SQLiteType typ = GetSQLiteType(i);
- return _activeStatement._sql.GetValue(_activeStatement, i, typ);
+ return _activeStatement._sql.GetValue(
+ _activeStatement, SQLiteCommand.GetFlags(_command), i, typ);
}
///
/// Retreives the values of multiple columns, up to the size of the supplied array
///
ADDED Tests/tkt-e06c4caff3.eagle
Index: Tests/tkt-e06c4caff3.eagle
==================================================================
--- /dev/null
+++ Tests/tkt-e06c4caff3.eagle
@@ -0,0 +1,99 @@
+###############################################################################
+#
+# tkt-e06c4caff3.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-e06c4caff3-1.1 {NaN to NULL constraint failure} -setup {
+ setupDb [set fileName tkt-e06c4caff3-1.1.db]
+} -body {
+ sql execute $db "CREATE TABLE t1(x REAL NOT NULL);"
+
+ sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
+ [list param1 Double [set NaN [object invoke Double NaN]]]
+} -cleanup {
+ cleanupDb $fileName
+
+ unset -nocomplain NaN db fileName
+} -constraints \
+{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
+-returnCodes 1 -match regexp -result [string map [list \n \r\n]\
+{^System\.Data\.SQLite\.SQLiteException \(0x80004005\): constraint failed
+t1\.x may not be NULL
+.*$}]}
+
+###############################################################################
+
+runTest {test tkt-e06c4caff3-1.2 {NaN to NULL} -setup {
+ setupDb [set fileName tkt-e06c4caff3-1.2.db]
+} -body {
+ sql execute $db "CREATE TABLE t1(x REAL);"
+
+ sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
+ [list param1 Double [set NaN [object invoke Double NaN]]]
+
+ sql execute -execute reader -format list $db "SELECT x FROM t1;"
+} -cleanup {
+ cleanupDb $fileName
+
+ unset -nocomplain NaN db fileName
+} -constraints \
+{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
+-result {}}
+
+###############################################################################
+
+runTest {test tkt-e06c4caff3-1.3 {NaN w/BindAllAsText} -setup {
+ setupDb [set fileName tkt-e06c4caff3-1.3.db] "" "" "" BindAllAsText
+} -body {
+ sql execute $db "CREATE TABLE t1(x REAL NOT NULL);"
+
+ list [sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
+ [list param1 Double [set NaN [object invoke Double NaN]]]] \
+ [sql execute -execute reader -format list $db "SELECT x FROM t1;"]
+} -cleanup {
+ cleanupDb $fileName
+
+ unset -nocomplain NaN db fileName
+} -constraints \
+{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
+{1 0}}
+
+###############################################################################
+
+runTest {test tkt-e06c4caff3-1.4 {NaN w/BindAllAsText & GetAllAsText} -setup {
+ setupDb [set fileName tkt-e06c4caff3-1.4.db] "" "" "" BindAndGetAllAsText
+} -body {
+ sql execute $db "CREATE TABLE t1(x REAL NOT NULL);"
+
+ list [sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
+ [list param1 Double [set NaN [object invoke Double NaN]]]] \
+ [sql execute -execute reader -format list $db "SELECT x FROM t1;"]
+} -cleanup {
+ cleanupDb $fileName
+
+ unset -nocomplain NaN db fileName
+} -constraints \
+{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
+{1 NaN}}
+
+###############################################################################
+
+runSQLiteTestEpilogue
+runTestEpilogue
Index: readme.htm
==================================================================
--- readme.htm
+++ readme.htm
@@ -202,11 +202,11 @@
Support custom connection pool implementations by adding the ISQLiteConnectionPool interface, the static SQLiteConnection.ConnectionPool property, and the static CreateHandle method in addition to modifying the SQLiteConnectionPool class. Pursuant to [393d954be0].
Add public constructor to the SQLiteDataAdapter class that allows passing the parseViaFramework parameter to the SQLiteConnection constructor.
When built with the CHECK_STATE compile-time option, skip throwing exceptions from the SQLiteDataReader class when the object is being disposed.
Support automatic value conversions for columns with a declared type of BIGUINT, INTEGER8, INTEGER16, INTEGER32, INTEGER64, SMALLUINT, TINYSINT, UNSIGNEDINTEGER, UNSIGNEDINTEGER8, UNSIGNEDINTEGER16, UNSIGNEDINTEGER32, UNSIGNEDINTEGER64, INT8, INT16, INT32, INT64, UINT, UINT8, UINT16, UINT32, UINT64, or ULONG.
Add BindUInt32AsInt64 connection flag to force binding of UInt32 values as Int64 instead. Pursuant to [c010fa6584].
- Add BindAllAsText connection flag to force binding of all values as text.
+ Add BindAllAsText and GetAllAsText connection flags to force binding and returning of all values as text.
Remove AUTOINCREMENT from the column type name map. ** Potentially Incompatible Change **
Avoid throwing overflow exceptions from the SQLite3.GetValue method for integral column types. Partial fix for [c010fa6584]. ** Potentially Incompatible Change **
Use the legacy connection closing algorithm when built with the INTEROP_LEGACY_CLOSE compile-time option.
Support using the directory containing the primary managed-only assembly as the basis for native library pre-loading.
Still further enhancements to the build and test automation.
Index: www/news.wiki
==================================================================
--- www/news.wiki
+++ www/news.wiki
@@ -18,11 +18,11 @@
Support custom connection pool implementations by adding the ISQLiteConnectionPool interface, the static SQLiteConnection.ConnectionPool property, and the static CreateHandle method in addition to modifying the SQLiteConnectionPool class. Pursuant to [393d954be0].
Add public constructor to the SQLiteDataAdapter class that allows passing the parseViaFramework parameter to the SQLiteConnection constructor.
When built with the CHECK_STATE compile-time option, skip throwing exceptions from the SQLiteDataReader class when the object is being disposed.
Support automatic value conversions for columns with a declared type of BIGUINT, INTEGER8, INTEGER16, INTEGER32, INTEGER64, SMALLUINT, TINYSINT, UNSIGNEDINTEGER, UNSIGNEDINTEGER8, UNSIGNEDINTEGER16, UNSIGNEDINTEGER32, UNSIGNEDINTEGER64, INT8, INT16, INT32, INT64, UINT, UINT8, UINT16, UINT32, UINT64, or ULONG.
Add BindUInt32AsInt64 connection flag to force binding of UInt32 values as Int64 instead. Pursuant to [c010fa6584].
- Add BindAllAsText connection flag to force binding of all values as text.
+ Add BindAllAsText and GetAllAsText connection flags to force binding and returning of all values as text.
Remove AUTOINCREMENT from the column type name map. ** Potentially Incompatible Change **
Avoid throwing overflow exceptions from the SQLite3.GetValue method for integral column types. Partial fix for [c010fa6584]. ** Potentially Incompatible Change **
Use the legacy connection closing algorithm when built with the INTEROP_LEGACY_CLOSE compile-time option.
Support using the directory containing the primary managed-only assembly as the basis for native library pre-loading.
Still further enhancements to the build and test automation.