Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Reform how connection flags are checked. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c947d6b1fbfc1929108d3fd020b065cb |
User & Date: | mistachkin 2018-08-27 04:56:14.363 |
Context
2018-09-05
| ||
01:56 | Add signed NuGet 4.x binary in externals that includes the '-VerbatimVersion' fix. check-in: be204390c7 user: mistachkin tags: trunk | |
2018-08-27
| ||
04:56 | Reform how connection flags are checked. check-in: c947d6b1fb user: mistachkin tags: trunk | |
2018-08-26
| ||
22:53 | Add the GetInvariantInt64 and GetInvariantDouble connection flags. check-in: e945d6e2f9 user: mistachkin tags: trunk | |
Changes
Changes to System.Data.SQLite/SQLite3.cs.
︙ | ︙ | |||
272 273 274 275 276 277 278 | { if (!_sql.OwnHandle) { _sql = null; return; } | < | | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | { if (!_sql.OwnHandle) { _sql = null; return; } bool unbindFunctions = HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UnbindFunctionsOnClose); retry: if (_usePool) { if (SQLiteBase.ResetConnection(_sql, _sql, !disposing) && UnhookNativeCallbacks(true, !disposing)) |
︙ | ︙ | |||
1051 1052 1053 1054 1055 1056 1057 | } finally /* NOTE: Thread.Abort() protection. */ { IntPtr db = IntPtr.Zero; SQLiteErrorCode n; #if !SQLITE_STANDARD | | | 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | } finally /* NOTE: Thread.Abort() protection. */ { IntPtr db = IntPtr.Zero; SQLiteErrorCode n; #if !SQLITE_STANDARD int extFuncs = HelperMethods.HasFlags(connectionFlags, SQLiteConnectionFlags.NoExtensionFunctions) ? 0 : 1; if (extFuncs != 0) { n = UnsafeNativeMethods.sqlite3_open_interop(ToUTF8(strFilename), ToUTF8(vfsName), openFlags, extFuncs, ref db); } else #endif |
︙ | ︙ | |||
1083 1084 1085 1086 1087 1088 1089 | null, null, null, _sql, strFilename, new object[] { typeof(SQLite3), strFilename, vfsName, connectionFlags, openFlags, maxPoolSize, usePool })); } // Bind functions to this connection. If any previous functions of the same name // were already bound, then the new bindings replace the old. | | | 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | null, null, null, _sql, strFilename, new object[] { typeof(SQLite3), strFilename, vfsName, connectionFlags, openFlags, maxPoolSize, usePool })); } // Bind functions to this connection. If any previous functions of the same name // were already bound, then the new bindings replace the old. if (!HelperMethods.HasFlags(connectionFlags, SQLiteConnectionFlags.NoBindFunctions)) { if (_functions == null) _functions = new Dictionary<SQLiteFunctionAttribute, SQLiteFunction>(); foreach (KeyValuePair<SQLiteFunctionAttribute, SQLiteFunction> pair in SQLiteFunction.BindFunctions(this, connectionFlags)) { |
︙ | ︙ | |||
1711 1712 1713 1714 1715 1716 1717 | if (ForceLogPrepare() || HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } SQLiteErrorCode n; | | | 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 | if (ForceLogPrepare() || HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } SQLiteErrorCode n; if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.BindUInt32AsInt64)) { long value2 = value; #if !PLATFORM_COMPACTFRAMEWORK n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value2); #elif !SQLITE_STANDARD n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value2); |
︙ | ︙ | |||
1814 1815 1816 1817 1818 1819 1820 | SQLiteStatementHandle handle = stmt._sqlite_stmt; if (ForceLogPrepare() || HelperMethods.LogBind(flags)) { LogBind(handle, index, dt); } | | | 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 | SQLiteStatementHandle handle = stmt._sqlite_stmt; if (ForceLogPrepare() || HelperMethods.LogBind(flags)) { LogBind(handle, index, dt); } if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.BindDateTimeWithKind)) { if ((_datetimeKind != DateTimeKind.Unspecified) && (dt.Kind != DateTimeKind.Unspecified) && (dt.Kind != _datetimeKind)) { if (_datetimeKind == DateTimeKind.Utc) dt = dt.ToUniversalTime(); |
︙ | ︙ | |||
4028 4029 4030 4031 4032 4033 4034 | if (typ.Type != DbType.Object) { t = SQLiteConvert.SQLiteTypeToType(typ); aff = TypeToAffinity(t, flags); } | | > | | > | | | 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 | if (typ.Type != DbType.Object) { t = SQLiteConvert.SQLiteTypeToType(typ); aff = TypeToAffinity(t, flags); } if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.GetAllAsText)) return GetText(stmt, index); switch (aff) { case TypeAffinity.Blob: if (typ.Type == DbType.Guid && typ.Affinity == TypeAffinity.Text) return new Guid(GetText(stmt, index)); int n = (int)GetBytes(stmt, index, 0, null, 0, 0); byte[] b = new byte[n]; GetBytes(stmt, index, 0, b, 0, n); if (typ.Type == DbType.Guid && n == 16) return new Guid(b); return b; case TypeAffinity.DateTime: return GetDateTime(stmt, index); case TypeAffinity.Double: if (t == null) return GetDouble(stmt, index); return Convert.ChangeType(GetDouble(stmt, index), t, HelperMethods.HasFlags(flags, SQLiteConnectionFlags.GetInvariantDouble) ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture); case TypeAffinity.Int64: if (t == null) return GetInt64(stmt, index); if (t == typeof(Boolean)) return GetBoolean(stmt, index); if (t == typeof(SByte)) return GetSByte(stmt, index); if (t == typeof(Byte)) return GetByte(stmt, index); if (t == typeof(Int16)) return GetInt16(stmt, index); if (t == typeof(UInt16)) return GetUInt16(stmt, index); if (t == typeof(Int32)) return GetInt32(stmt, index); if (t == typeof(UInt32)) return GetUInt32(stmt, index); if (t == typeof(Int64)) return GetInt64(stmt, index); if (t == typeof(UInt64)) return GetUInt64(stmt, index); return Convert.ChangeType(GetInt64(stmt, index), t, HelperMethods.HasFlags(flags, SQLiteConnectionFlags.GetInvariantInt64) ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture); default: return GetText(stmt, index); } } internal override int GetCursorForTable(SQLiteStatement stmt, int db, int rootPage) { |
︙ | ︙ |
Changes to System.Data.SQLite/SQLite3_UTF16.cs.
︙ | ︙ | |||
177 178 179 180 181 182 183 | // do nothing. } finally /* NOTE: Thread.Abort() protection. */ { IntPtr db = IntPtr.Zero; SQLiteErrorCode n; | | | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | // do nothing. } finally /* NOTE: Thread.Abort() protection. */ { IntPtr db = IntPtr.Zero; SQLiteErrorCode n; int extFuncs = HelperMethods.HasFlags(connectionFlags, SQLiteConnectionFlags.NoExtensionFunctions) ? 0 : 1; #if !SQLITE_STANDARD if ((vfsName != null) || (extFuncs != 0)) { n = UnsafeNativeMethods.sqlite3_open16_interop(ToUTF8(strFilename), ToUTF8(vfsName), openFlags, extFuncs, ref db); } else |
︙ | ︙ | |||
226 227 228 229 230 231 232 | null, null, null, _sql, strFilename, new object[] { typeof(SQLite3_UTF16), strFilename, vfsName, connectionFlags, openFlags, maxPoolSize, usePool })); } // Bind functions to this connection. If any previous functions of the same name // were already bound, then the new bindings replace the old. | | | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | null, null, null, _sql, strFilename, new object[] { typeof(SQLite3_UTF16), strFilename, vfsName, connectionFlags, openFlags, maxPoolSize, usePool })); } // Bind functions to this connection. If any previous functions of the same name // were already bound, then the new bindings replace the old. if (!HelperMethods.HasFlags(connectionFlags, SQLiteConnectionFlags.NoBindFunctions)) { if (_functions == null) _functions = new Dictionary<SQLiteFunctionAttribute, SQLiteFunction>(); foreach (KeyValuePair<SQLiteFunctionAttribute, SQLiteFunction> pair in SQLiteFunction.BindFunctions(this, connectionFlags)) { |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteConnection.cs.
︙ | ︙ | |||
2721 2722 2723 2724 2725 2726 2727 | /// </summary> /// <param name="disposing"> /// Zero when being disposed via garbage collection; otherwise, non-zero. /// </param> protected override void Dispose(bool disposing) { #if !NET_COMPACT_20 && TRACE_WARNING | | | 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 | /// </summary> /// <param name="disposing"> /// Zero when being disposed via garbage collection; otherwise, non-zero. /// </param> protected override void Dispose(bool disposing) { #if !NET_COMPACT_20 && TRACE_WARNING if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.TraceWarning)) { if (_noDispose) { System.Diagnostics.Trace.WriteLine(HelperMethods.StringFormat( CultureInfo.CurrentCulture, "WARNING: Disposing of connection \"{0}\" with the no-dispose flag set.", _connectionString)); |
︙ | ︙ | |||
2934 2935 2936 2937 2938 2939 2940 | isolationLevel = GetEffectiveIsolationLevel(isolationLevel); if (isolationLevel != ImmediateIsolationLevel && isolationLevel != DeferredIsolationLevel) throw new ArgumentException("isolationLevel"); SQLiteTransaction transaction; | < | | 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 | isolationLevel = GetEffectiveIsolationLevel(isolationLevel); if (isolationLevel != ImmediateIsolationLevel && isolationLevel != DeferredIsolationLevel) throw new ArgumentException("isolationLevel"); SQLiteTransaction transaction; if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.AllowNestedTransactions)) { transaction = new SQLiteTransaction2( this, isolationLevel != ImmediateIsolationLevel); } else { transaction = new SQLiteTransaction( |
︙ | ︙ | |||
3476 3477 3478 3479 3480 3481 3482 | CheckDisposed(); bool waitForEnlistmentReset; int waitTimeout; lock (_enlistmentSyncRoot) /* TRANSACTIONAL */ { | | | | | | 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 | CheckDisposed(); bool waitForEnlistmentReset; int waitTimeout; lock (_enlistmentSyncRoot) /* TRANSACTIONAL */ { waitForEnlistmentReset = HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.WaitForEnlistmentReset); waitTimeout = _waitTimeout; } if (waitForEnlistmentReset) /* IGNORED */ WaitForEnlistmentReset(waitTimeout, null); lock (_enlistmentSyncRoot) /* TRANSACTIONAL */ { if (_enlistment != null && transaction == _enlistment._scope) return; else if (_enlistment != null) throw new ArgumentException("Already enlisted in a transaction"); if (_transactionLevel > 0 && transaction != null) throw new ArgumentException("Unable to enlist in transaction, a local transaction already exists"); else if (transaction == null) throw new ArgumentNullException("Unable to enlist in transaction, it is null"); bool strictEnlistment = HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.StrictEnlistment); _enlistment = new SQLiteEnlistment(this, transaction, GetFallbackDefaultIsolationLevel(), strictEnlistment, strictEnlistment); OnChanged(this, new ConnectionEventArgs( SQLiteConnectionEventType.EnlistTransaction, null, null, null, null, |
︙ | ︙ | |||
3776 3777 3778 3779 3780 3781 3782 | if (_sql == null) { throw new InvalidOperationException( "Database connection not valid for changing a configuration option."); } if ((option == SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION) && | | | 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 | if (_sql == null) { throw new InvalidOperationException( "Database connection not valid for changing a configuration option."); } if ((option == SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION) && HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoLoadExtension)) { throw new SQLiteException("Loading extensions is disabled for this database connection."); } SQLiteErrorCode rc = _sql.SetConfigurationOption(option, value); if (rc != SQLiteErrorCode.Ok) |
︙ | ︙ | |||
3805 3806 3807 3808 3809 3810 3811 | if (_sql == null) throw new InvalidOperationException(HelperMethods.StringFormat( CultureInfo.CurrentCulture, "Database connection not valid for {0} extensions.", enable ? "enabling" : "disabling")); | | | 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 | if (_sql == null) throw new InvalidOperationException(HelperMethods.StringFormat( CultureInfo.CurrentCulture, "Database connection not valid for {0} extensions.", enable ? "enabling" : "disabling")); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoLoadExtension)) throw new SQLiteException("Loading extensions is disabled for this database connection."); _sql.SetLoadExtension(enable); } /// <summary> /// Loads a SQLite extension library from the named dynamic link library file. |
︙ | ︙ | |||
3847 3848 3849 3850 3851 3852 3853 | { CheckDisposed(); if (_sql == null) throw new InvalidOperationException( "Database connection not valid for loading extensions."); | | | 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 | { CheckDisposed(); if (_sql == null) throw new InvalidOperationException( "Database connection not valid for loading extensions."); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoLoadExtension)) throw new SQLiteException("Loading extensions is disabled for this database connection."); _sql.LoadExtension(fileName, procName); } #if INTEROP_VIRTUAL_TABLE /// <summary> |
︙ | ︙ | |||
3871 3872 3873 3874 3875 3876 3877 | { CheckDisposed(); if (_sql == null) throw new InvalidOperationException( "Database connection not valid for creating modules."); | | | 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 | { CheckDisposed(); if (_sql == null) throw new InvalidOperationException( "Database connection not valid for creating modules."); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoCreateModule)) throw new SQLiteException("Creating modules is disabled for this database connection."); _sql.CreateModule(module, _flags); } #endif /// <summary> |
︙ | ︙ | |||
4002 4003 4004 4005 4006 4007 4008 | /// </returns> private bool GetDefaultPooling() { bool result = DefaultPooling; if (result) /* NOTE: True branch not reached in the default build. */ { | | | | | | 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 | /// </returns> private bool GetDefaultPooling() { bool result = DefaultPooling; if (result) /* NOTE: True branch not reached in the default build. */ { if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoConnectionPool)) result = false; if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionPool)) result = true; } else { if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionPool)) result = true; if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoConnectionPool)) result = false; } return result; } /// <summary> |
︙ | ︙ | |||
4037 4038 4039 4040 4041 4042 4043 | /// <returns> /// The transaction isolation level that should be used. /// </returns> private IsolationLevel GetEffectiveIsolationLevel( IsolationLevel isolationLevel ) { | | | | 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 | /// <returns> /// The transaction isolation level that should be used. /// </returns> private IsolationLevel GetEffectiveIsolationLevel( IsolationLevel isolationLevel ) { if (!HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.MapIsolationLevels)) { return isolationLevel; } switch (isolationLevel) { case IsolationLevel.Unspecified: |
︙ | ︙ | |||
4189 4190 4191 4192 4193 4194 4195 | #endif } } bool isMemory = (String.Compare(fileName, MemoryFileName, StringComparison.OrdinalIgnoreCase) == 0); #if !NET_COMPACT_20 && TRACE_WARNING | | | 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 | #endif } } bool isMemory = (String.Compare(fileName, MemoryFileName, StringComparison.OrdinalIgnoreCase) == 0); #if !NET_COMPACT_20 && TRACE_WARNING if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.TraceWarning)) { if (!uri && !fullUri && !isMemory && !String.IsNullOrEmpty(fileName) && fileName.StartsWith("\\", StringComparison.OrdinalIgnoreCase) && !fileName.StartsWith("\\\\", StringComparison.OrdinalIgnoreCase)) { System.Diagnostics.Trace.WriteLine(HelperMethods.StringFormat( CultureInfo.CurrentCulture, |
︙ | ︙ | |||
6756 6757 6758 6759 6760 6761 6762 | // do nothing. } } // // NOTE: Should throwing an exception interrupt the operation? // | | | | 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 | // do nothing. } } // // NOTE: Should throwing an exception interrupt the operation? // if (HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.InterruptOnException)) { return SQLiteProgressReturnCode.Interrupt; } else { return SQLiteProgressReturnCode.Continue; } |
︙ | ︙ | |||
6808 6809 6810 6811 6812 6813 6814 | // do nothing. } } // // NOTE: Should throwing an exception deny the action? // | | | | 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 | // do nothing. } } // // NOTE: Should throwing an exception deny the action? // if (HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.DenyOnException)) { return SQLiteAuthorizerReturnCode.Deny; } else { return SQLiteAuthorizerReturnCode.Ok; } |
︙ | ︙ | |||
7007 7008 7009 7010 7011 7012 7013 | // do nothing. } } // // NOTE: Should throwing an exception rollback the transaction? // | | | | 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 | // do nothing. } } // // NOTE: Should throwing an exception rollback the transaction? // if (HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.RollbackOnException)) { return 1; // rollback } else { return 0; // commit } |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteConvert.cs.
︙ | ︙ | |||
1424 1425 1426 1427 1428 1429 1430 | private static string GetDefaultTypeName( SQLiteConnection connection ) { SQLiteConnectionFlags flags = (connection != null) ? connection.Flags : SQLiteConnectionFlags.None; | | | | 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 | private static string GetDefaultTypeName( SQLiteConnection connection ) { SQLiteConnectionFlags flags = (connection != null) ? connection.Flags : SQLiteConnectionFlags.None; if (HelperMethods.HasFlags( flags, SQLiteConnectionFlags.NoConvertSettings)) { return FallbackDefaultTypeName; } string name = "Use_SQLiteConvert_DefaultTypeName"; object value = null; string @default = null; |
︙ | ︙ | |||
1474 1475 1476 1477 1478 1479 1480 | /// </param> private static void DefaultTypeNameWarning( DbType dbType, SQLiteConnectionFlags flags, string typeName ) { | | | 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 | /// </param> private static void DefaultTypeNameWarning( DbType dbType, SQLiteConnectionFlags flags, string typeName ) { if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.TraceWarning)) { Trace.WriteLine(HelperMethods.StringFormat( CultureInfo.CurrentCulture, "WARNING: Type mapping failed, returning default name \"{0}\" for type {1}.", typeName, dbType)); } } |
︙ | ︙ | |||
1503 1504 1505 1506 1507 1508 1509 | private static void DefaultDbTypeWarning( string typeName, SQLiteConnectionFlags flags, DbType? dbType ) { if (!String.IsNullOrEmpty(typeName) && | | | 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 | private static void DefaultDbTypeWarning( string typeName, SQLiteConnectionFlags flags, DbType? dbType ) { if (!String.IsNullOrEmpty(typeName) && HelperMethods.HasFlags(flags, SQLiteConnectionFlags.TraceWarning)) { Trace.WriteLine(HelperMethods.StringFormat( CultureInfo.CurrentCulture, "WARNING: Type mapping failed, returning default type {0} for name \"{1}\".", dbType, typeName)); } } |
︙ | ︙ | |||
1532 1533 1534 1535 1536 1537 1538 | { string defaultTypeName = null; if (connection != null) { flags |= connection.Flags; | | | | 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 | { string defaultTypeName = null; if (connection != null) { flags |= connection.Flags; if (HelperMethods.HasFlags(flags, 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 (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.NoGlobalTypes)) { if (defaultTypeName != null) return defaultTypeName; defaultTypeName = GetDefaultTypeName(connection); #if !NET_COMPACT_20 && TRACE_WARNING |
︙ | ︙ | |||
1656 1657 1658 1659 1660 1661 1662 | { if (typ == typeof(byte[]) || typ == typeof(Guid)) return TypeAffinity.Blob; else return TypeAffinity.Text; } if ((tc == TypeCode.Decimal) && | | | 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 | { if (typ == typeof(byte[]) || typ == typeof(Guid)) return TypeAffinity.Blob; else return TypeAffinity.Text; } if ((tc == TypeCode.Decimal) && HelperMethods.HasFlags(flags, SQLiteConnectionFlags.GetDecimalAsText)) { return TypeAffinity.Text; } return _typecodeAffinities[(int)tc]; } private static TypeAffinity[] _typecodeAffinities = { |
︙ | ︙ | |||
1840 1841 1842 1843 1844 1845 1846 | private static DbType GetDefaultDbType( SQLiteConnection connection ) { SQLiteConnectionFlags flags = (connection != null) ? connection.Flags : SQLiteConnectionFlags.None; | | | | 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 | private static DbType GetDefaultDbType( SQLiteConnection connection ) { SQLiteConnectionFlags flags = (connection != null) ? connection.Flags : SQLiteConnectionFlags.None; if (HelperMethods.HasFlags( flags, SQLiteConnectionFlags.NoConvertSettings)) { return FallbackDefaultDbType; } bool found = false; string name = "Use_SQLiteConvert_DefaultDbType"; object value = null; |
︙ | ︙ | |||
2076 2077 2078 2079 2080 2081 2082 | { DbType? defaultDbType = null; if (connection != null) { flags |= connection.Flags; | | | 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 | { DbType? defaultDbType = null; if (connection != null) { flags |= connection.Flags; if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.UseConnectionTypes)) { SQLiteDbTypeMap connectionTypeNames = connection._typeNames; if (connectionTypeNames != null) { if (typeName != null) { |
︙ | ︙ | |||
2110 2111 2112 2113 2114 2115 2116 | // // NOTE: Use the default database type for the connection. // defaultDbType = connection.DefaultDbType; } | | | 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 | // // NOTE: Use the default database type for the connection. // defaultDbType = connection.DefaultDbType; } if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.NoGlobalTypes)) { if (defaultDbType != null) return (DbType)defaultDbType; defaultDbType = GetDefaultDbType(connection); #if !NET_COMPACT_20 && TRACE_WARNING |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteDataReader.cs.
︙ | ︙ | |||
387 388 389 390 391 392 393 | /// <returns> /// This function throws an InvalidTypeCast() exception if the requested type doesn't match the column's definition or affinity. /// </returns> /// <param name="i">The index of the column to type-check</param> /// <param name="typ">The type we want to get out of the column</param> private TypeAffinity VerifyType(int i, DbType typ) { | | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | /// <returns> /// This function throws an InvalidTypeCast() exception if the requested type doesn't match the column's definition or affinity. /// </returns> /// <param name="i">The index of the column to type-check</param> /// <param name="typ">The type we want to get out of the column</param> private TypeAffinity VerifyType(int i, DbType typ) { if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoVerifyTypeAffinity)) return TypeAffinity.None; TypeAffinity affinity = GetSQLiteType(_flags, i).Affinity; switch (affinity) { case TypeAffinity.Int64: |
︙ | ︙ | |||
543 544 545 546 547 548 549 | /// </param> /// <returns>A new <see cref="SQLiteBlob" /> object.</returns> public SQLiteBlob GetBlob(int i, bool readOnly) { CheckDisposed(); VerifyForGet(); | | | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | /// </param> /// <returns>A new <see cref="SQLiteBlob" /> object.</returns> public SQLiteBlob GetBlob(int i, bool readOnly) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetBlob", new SQLiteReadBlobEventArgs(readOnly), value), out complete); |
︙ | ︙ | |||
572 573 574 575 576 577 578 | /// <param name="i">The index of the column.</param> /// <returns>bool</returns> public override bool GetBoolean(int i) { CheckDisposed(); VerifyForGet(); | | | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | /// <param name="i">The index of the column.</param> /// <returns>bool</returns> public override bool GetBoolean(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetBoolean", null, value), out complete); |
︙ | ︙ | |||
606 607 608 609 610 611 612 | /// <param name="i">The index of the column.</param> /// <returns>byte</returns> public override byte GetByte(int i) { CheckDisposed(); VerifyForGet(); | | | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | /// <param name="i">The index of the column.</param> /// <returns>byte</returns> public override byte GetByte(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetByte", null, value), out complete); |
︙ | ︙ | |||
647 648 649 650 651 652 653 | /// To determine the number of bytes in the column, pass a null value for the buffer. The total length will be returned. /// </remarks> public override long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length) { CheckDisposed(); VerifyForGet(); | | | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | /// To determine the number of bytes in the column, pass a null value for the buffer. The total length will be returned. /// </remarks> public override long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteReadArrayEventArgs eventArgs = new SQLiteReadArrayEventArgs( fieldOffset, buffer, bufferoffset, length); SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; |
︙ | ︙ | |||
700 701 702 703 704 705 706 | /// <param name="i">The index of the column.</param> /// <returns>char</returns> public override char GetChar(int i) { CheckDisposed(); VerifyForGet(); | | | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | /// <param name="i">The index of the column.</param> /// <returns>char</returns> public override char GetChar(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetChar", null, value), out complete); |
︙ | ︙ | |||
741 742 743 744 745 746 747 | /// To determine the number of characters in the column, pass a null value for the buffer. The total length will be returned. /// </remarks> public override long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length) { CheckDisposed(); VerifyForGet(); | | | 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | /// To determine the number of characters in the column, pass a null value for the buffer. The total length will be returned. /// </remarks> public override long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteReadArrayEventArgs eventArgs = new SQLiteReadArrayEventArgs( fieldoffset, buffer, bufferoffset, length); SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; |
︙ | ︙ | |||
780 781 782 783 784 785 786 | } } } if (i >= PrivateVisibleFieldCount && _keyInfo != null) return _keyInfo.GetChars(i - PrivateVisibleFieldCount, fieldoffset, buffer, bufferoffset, length); | | | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | } } } if (i >= PrivateVisibleFieldCount && _keyInfo != null) return _keyInfo.GetChars(i - PrivateVisibleFieldCount, fieldoffset, buffer, bufferoffset, length); if (!HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoVerifyTextAffinity)) VerifyType(i, DbType.String); return _activeStatement._sql.GetChars(_activeStatement, i, (int)fieldoffset, buffer, bufferoffset, length); } /// <summary> /// Retrieves the name of the back-end datatype of the column |
︙ | ︙ | |||
812 813 814 815 816 817 818 | /// <param name="i">The index of the column.</param> /// <returns>DateTime</returns> public override DateTime GetDateTime(int i) { CheckDisposed(); VerifyForGet(); | | | 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 | /// <param name="i">The index of the column.</param> /// <returns>DateTime</returns> public override DateTime GetDateTime(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetDateTime", null, value), out complete); |
︙ | ︙ | |||
846 847 848 849 850 851 852 | /// <param name="i">The index of the column.</param> /// <returns>decimal</returns> public override decimal GetDecimal(int i) { CheckDisposed(); VerifyForGet(); | | | 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | /// <param name="i">The index of the column.</param> /// <returns>decimal</returns> public override decimal GetDecimal(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetDecimal", null, value), out complete); |
︙ | ︙ | |||
870 871 872 873 874 875 876 | if (i >= PrivateVisibleFieldCount && _keyInfo != null) return _keyInfo.GetDecimal(i - PrivateVisibleFieldCount); VerifyType(i, DbType.Decimal); CultureInfo cultureInfo = CultureInfo.CurrentCulture; | | | | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | if (i >= PrivateVisibleFieldCount && _keyInfo != null) return _keyInfo.GetDecimal(i - PrivateVisibleFieldCount); VerifyType(i, DbType.Decimal); CultureInfo cultureInfo = CultureInfo.CurrentCulture; if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.GetInvariantDecimal)) cultureInfo = CultureInfo.InvariantCulture; return Decimal.Parse(_activeStatement._sql.GetText(_activeStatement, i), NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent | NumberStyles.AllowLeadingSign, cultureInfo); } /// <summary> /// Returns the column as a double /// </summary> /// <param name="i">The index of the column.</param> /// <returns>double</returns> public override double GetDouble(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetDouble", null, value), out complete); |
︙ | ︙ | |||
956 957 958 959 960 961 962 | /// <param name="i">The index of the column.</param> /// <returns>float</returns> public override float GetFloat(int i) { CheckDisposed(); VerifyForGet(); | | | 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 | /// <param name="i">The index of the column.</param> /// <returns>float</returns> public override float GetFloat(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetFloat", null, value), out complete); |
︙ | ︙ | |||
990 991 992 993 994 995 996 | /// <param name="i">The index of the column.</param> /// <returns>Guid</returns> public override Guid GetGuid(int i) { CheckDisposed(); VerifyForGet(); | | | 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | /// <param name="i">The index of the column.</param> /// <returns>Guid</returns> public override Guid GetGuid(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetGuid", null, value), out complete); |
︙ | ︙ | |||
1031 1032 1033 1034 1035 1036 1037 | /// <param name="i">The index of the column.</param> /// <returns>Int16</returns> public override Int16 GetInt16(int i) { CheckDisposed(); VerifyForGet(); | | | 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | /// <param name="i">The index of the column.</param> /// <returns>Int16</returns> public override Int16 GetInt16(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetInt16", null, value), out complete); |
︙ | ︙ | |||
1065 1066 1067 1068 1069 1070 1071 | /// <param name="i">The index of the column.</param> /// <returns>Int32</returns> public override Int32 GetInt32(int i) { CheckDisposed(); VerifyForGet(); | | | 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 | /// <param name="i">The index of the column.</param> /// <returns>Int32</returns> public override Int32 GetInt32(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetInt32", null, value), out complete); |
︙ | ︙ | |||
1099 1100 1101 1102 1103 1104 1105 | /// <param name="i">The index of the column.</param> /// <returns>Int64</returns> public override Int64 GetInt64(int i) { CheckDisposed(); VerifyForGet(); | | | 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 | /// <param name="i">The index of the column.</param> /// <returns>Int64</returns> public override Int64 GetInt64(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetInt64", null, value), out complete); |
︙ | ︙ | |||
1674 1675 1676 1677 1678 1679 1680 | /// <param name="i">The index of the column.</param> /// <returns>string</returns> public override string GetString(int i) { CheckDisposed(); VerifyForGet(); | | | | > | > | | 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 | /// <param name="i">The index of the column.</param> /// <returns>string</returns> public override string GetString(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetString", null, value), out complete); if (complete) return value.StringValue; } if (i >= PrivateVisibleFieldCount && _keyInfo != null) return _keyInfo.GetString(i - PrivateVisibleFieldCount); if (!HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoVerifyTextAffinity)) VerifyType(i, DbType.String); return _activeStatement._sql.GetText(_activeStatement, i); } /// <summary> /// Retrieves the column as an object corresponding to the underlying datatype of the column /// </summary> /// <param name="i">The index of the column.</param> /// <returns>object</returns> public override object GetValue(int i) { CheckDisposed(); VerifyForGet(); if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks)) { SQLiteDataReaderValue value = new SQLiteDataReaderValue(); bool complete; InvokeReadValueCallback(i, new SQLiteReadValueEventArgs( "GetValue", null, value), out complete); if (complete) return value.Value; } if (i >= PrivateVisibleFieldCount && _keyInfo != null) return _keyInfo.GetValue(i - PrivateVisibleFieldCount); SQLiteType typ = GetSQLiteType(_flags, i); if (HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.DetectTextAffinity) && ((typ == null) || (typ.Affinity == TypeAffinity.Text))) { typ = GetSQLiteType( typ, _activeStatement._sql.GetText(_activeStatement, i)); } else if (HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.DetectStringType) && ((typ == null) || SQLiteConvert.IsStringDbType(typ.Type))) { typ = GetSQLiteType( typ, _activeStatement._sql.GetText(_activeStatement, i)); } return _activeStatement._sql.GetValue(_activeStatement, _flags, i, typ); |
︙ | ︙ | |||
1807 1808 1809 1810 1811 1812 1813 | // NOTE: If the "sticky" flag has been set, use the new behavior, // which returns non-zero if there were ever any rows in // the associated result sets. Generally, this flag is only // useful when it is necessary to retain compatibility with // other ADO.NET providers that use these same semantics for // the HasRows property. // | > | > > | 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 | // NOTE: If the "sticky" flag has been set, use the new behavior, // which returns non-zero if there were ever any rows in // the associated result sets. Generally, this flag is only // useful when it is necessary to retain compatibility with // other ADO.NET providers that use these same semantics for // the HasRows property. // if (HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.StickyHasRows)) { return ((_readingState != 1) || (_stepCount > 0)); } // // NOTE: This is the default behavior. It returns non-zero only if // more rows are available (i.e. a call to the Read method is // expected to succeed). Prior to the introduction of the // "sticky" flag, this is how this property has always worked. // |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteStatement.cs.
︙ | ︙ | |||
319 320 321 322 323 324 325 | if (typeName == null) { // // NOTE: Are we allowed to fallback to using the parameter name // as the basis for looking up the binding callback? // | | | | | | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | if (typeName == null) { // // NOTE: Are we allowed to fallback to using the parameter name // as the basis for looking up the binding callback? // if (HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.UseParameterNameForTypeName)) { typeName = parameter.ParameterName; } } if (typeName == null) { // // NOTE: Are we allowed to fallback to using the database type // name translated from the DbType as the basis for looking // up the binding callback? // if (HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.UseParameterDbTypeForTypeName)) { typeName = SQLiteConvert.DbTypeToTypeName( connection, parameter.DbType, _flags); } } if (typeName == null) |
︙ | ︙ | |||
379 380 381 382 383 384 385 | /// <param name="index">The index of the parameter to bind</param> /// <param name="param">The parameter we're binding</param> private void BindParameter(int index, SQLiteParameter param) { if (param == null) throw new SQLiteException("Insufficient parameters supplied to the command"); | > | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | /// <param name="index">The index of the parameter to bind</param> /// <param name="param">The parameter we're binding</param> private void BindParameter(int index, SQLiteParameter param) { if (param == null) throw new SQLiteException("Insufficient parameters supplied to the command"); if (HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.UseConnectionBindValueCallbacks)) { bool complete; InvokeBindValueCallback(index, param, out complete); if (complete) return; |
︙ | ︙ | |||
413 414 415 416 417 418 419 | { _sql.Bind_Null(this, _flags, index); return; } CultureInfo invariantCultureInfo = CultureInfo.InvariantCulture; | | | > | > | > > | | | > | | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | { _sql.Bind_Null(this, _flags, index); return; } CultureInfo invariantCultureInfo = CultureInfo.InvariantCulture; bool invariantText = HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.BindInvariantText); CultureInfo cultureInfo = CultureInfo.CurrentCulture; if (HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.ConvertInvariantText)) { cultureInfo = invariantCultureInfo; } if (HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.BindAllAsText)) { if (obj is DateTime) { _sql.Bind_DateTime(this, _flags, index, (DateTime)obj); } else { _sql.Bind_Text(this, _flags, index, invariantText ? SQLiteConvert.ToStringWithProvider(obj, invariantCultureInfo) : SQLiteConvert.ToStringWithProvider(obj, cultureInfo)); } return; } bool invariantDecimal = HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.BindInvariantDecimal); if (HelperMethods.HasFlags( _flags, SQLiteConnectionFlags.BindDecimalAsText)) { if (obj is Decimal) { _sql.Bind_Text(this, _flags, index, invariantText || invariantDecimal ? SQLiteConvert.ToStringWithProvider(obj, invariantCultureInfo) : SQLiteConvert.ToStringWithProvider(obj, cultureInfo)); |
︙ | ︙ |
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
︙ | ︙ | |||
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | #else return 0; #endif } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Determines if preparing a query should be logged. /// </summary> /// <param name="flags"> /// The flags associated with the parent connection object. /// </param> /// <returns> /// Non-zero if the query preparation should be logged; otherwise, zero. /// </returns> internal static bool LogPrepare( SQLiteConnectionFlags flags ) { | > > > > > > > > > > > > > > > > > > > > > > > > | < | < | < | < | < | < | < | < | 604 605 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 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | #else return 0; #endif } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Determines if the specified flags are present within the flags /// associated with the parent connection object. /// </summary> /// <param name="flags"> /// The flags associated with the parent connection object. /// </param> /// <param name="hasFlags"> /// The flags to check for. /// </param> /// <returns> /// Non-zero if the specified flag or flags were present; otherwise, /// zero. /// </returns> internal static bool HasFlags( SQLiteConnectionFlags flags, SQLiteConnectionFlags hasFlags ) { return ((flags & hasFlags) == hasFlags); } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Determines if preparing a query should be logged. /// </summary> /// <param name="flags"> /// The flags associated with the parent connection object. /// </param> /// <returns> /// Non-zero if the query preparation should be logged; otherwise, zero. /// </returns> internal static bool LogPrepare( SQLiteConnectionFlags flags ) { return HasFlags(flags, SQLiteConnectionFlags.LogPrepare); } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Determines if pre-parameter binding should be logged. /// </summary> /// <param name="flags"> /// The flags associated with the parent connection object. /// </param> /// <returns> /// Non-zero if the pre-parameter binding should be logged; otherwise, /// zero. /// </returns> internal static bool LogPreBind( SQLiteConnectionFlags flags ) { return HasFlags(flags, SQLiteConnectionFlags.LogPreBind); } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Determines if parameter binding should be logged. /// </summary> /// <param name="flags"> /// The flags associated with the parent connection object. /// </param> /// <returns> /// Non-zero if the parameter binding should be logged; otherwise, zero. /// </returns> internal static bool LogBind( SQLiteConnectionFlags flags ) { return HasFlags(flags, SQLiteConnectionFlags.LogBind); } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Determines if an exception in a native callback should be logged. /// </summary> /// <param name="flags"> /// The flags associated with the parent connection object. /// </param> /// <returns> /// Non-zero if the exception should be logged; otherwise, zero. /// </returns> internal static bool LogCallbackExceptions( SQLiteConnectionFlags flags ) { return HasFlags(flags, SQLiteConnectionFlags.LogCallbackException); } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Determines if backup API errors should be logged. /// </summary> /// <param name="flags"> /// The flags associated with the parent connection object. /// </param> /// <returns> /// Non-zero if the backup API error should be logged; otherwise, zero. /// </returns> internal static bool LogBackup( SQLiteConnectionFlags flags ) { return HasFlags(flags, SQLiteConnectionFlags.LogBackup); } #if INTEROP_VIRTUAL_TABLE ///////////////////////////////////////////////////////////////////////// /// <summary> /// Determines if logging for the <see cref="SQLiteModule" /> class is /// disabled. /// </summary> /// <param name="flags"> /// The flags associated with the parent connection object. /// </param> /// <returns> /// Non-zero if logging for the <see cref="SQLiteModule" /> class is /// disabled; otherwise, zero. /// </returns> internal static bool NoLogModule( SQLiteConnectionFlags flags ) { return HasFlags(flags, SQLiteConnectionFlags.NoLogModule); } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Determines if <see cref="SQLiteModule" /> errors should be logged. /// </summary> /// <param name="flags"> /// The flags associated with the parent connection object. /// </param> /// <returns> /// Non-zero if the <see cref="SQLiteModule" /> error should be logged; /// otherwise, zero. /// </returns> internal static bool LogModuleError( SQLiteConnectionFlags flags ) { return HasFlags(flags, SQLiteConnectionFlags.LogModuleError); } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Determines if <see cref="SQLiteModule" /> exceptions should be /// logged. /// </summary> /// <param name="flags"> /// The flags associated with the parent connection object. /// </param> /// <returns> /// Non-zero if the <see cref="SQLiteModule" /> exception should be /// logged; otherwise, zero. /// </returns> internal static bool LogModuleException( SQLiteConnectionFlags flags ) { return HasFlags(flags, SQLiteConnectionFlags.LogModuleException); } #endif ///////////////////////////////////////////////////////////////////////// /// <summary> /// Determines if the current process is running on one of the Windows /// [sub-]platforms. |
︙ | ︙ |