Index: System.Data.SQLite/SQLite3.cs ================================================================== --- System.Data.SQLite/SQLite3.cs +++ System.Data.SQLite/SQLite3.cs @@ -1342,11 +1342,11 @@ if ( #if !PLATFORM_COMPACTFRAMEWORK ForceLogPrepare() || #endif - ((flags & SQLiteConnectionFlags.LogPrepare) == SQLiteConnectionFlags.LogPrepare)) + HelperMethods.LogPrepare(flags)) { if ((strSql == null) || (strSql.Length == 0) || (strSql.Trim().Length == 0)) SQLiteLog.LogMessage("Preparing {}..."); else SQLiteLog.LogMessage(HelperMethods.StringFormat( @@ -1610,11 +1610,11 @@ internal override void Bind_Double(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, double value) { SQLiteStatementHandle handle = stmt._sqlite_stmt; - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } #if !PLATFORM_COMPACTFRAMEWORK @@ -1630,11 +1630,11 @@ internal override void Bind_Int32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, int value) { SQLiteStatementHandle handle = stmt._sqlite_stmt; - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int(handle, index, value); @@ -1643,11 +1643,11 @@ internal override void Bind_UInt32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, uint value) { SQLiteStatementHandle handle = stmt._sqlite_stmt; - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } SQLiteErrorCode n; @@ -1673,11 +1673,11 @@ internal override void Bind_Int64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, long value) { SQLiteStatementHandle handle = stmt._sqlite_stmt; - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } #if !PLATFORM_COMPACTFRAMEWORK @@ -1693,11 +1693,11 @@ internal override void Bind_UInt64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, ulong value) { SQLiteStatementHandle handle = stmt._sqlite_stmt; - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } #if !PLATFORM_COMPACTFRAMEWORK @@ -1713,11 +1713,11 @@ internal override void Bind_Boolean(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, bool value) { SQLiteStatementHandle handle = stmt._sqlite_stmt; - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } int value2 = value ? 1 : 0; @@ -1728,18 +1728,18 @@ internal override void Bind_Text(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, string value) { SQLiteStatementHandle handle = stmt._sqlite_stmt; - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } byte[] b = ToUTF8(value); - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, b); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_text(handle, index, b, b.Length - 1, (IntPtr)(-1)); @@ -1748,11 +1748,11 @@ internal override void Bind_DateTime(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, DateTime dt) { SQLiteStatementHandle handle = stmt._sqlite_stmt; - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, dt); } if ((flags & SQLiteConnectionFlags.BindDateTimeWithKind) == SQLiteConnectionFlags.BindDateTimeWithKind) @@ -1772,11 +1772,11 @@ { case SQLiteDateFormats.Ticks: { long value = dt.Ticks; - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } #if !PLATFORM_COMPACTFRAMEWORK @@ -1793,11 +1793,11 @@ } case SQLiteDateFormats.JulianDay: { double value = ToJulianDay(dt); - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } #if !PLATFORM_COMPACTFRAMEWORK @@ -1814,11 +1814,11 @@ } case SQLiteDateFormats.UnixEpoch: { long value = Convert.ToInt64(dt.Subtract(UnixEpoch).TotalSeconds); - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } #if !PLATFORM_COMPACTFRAMEWORK @@ -1835,11 +1835,11 @@ } default: { byte[] b = ToUTF8(dt); - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, b); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_text(handle, index, b, b.Length - 1, (IntPtr)(-1)); @@ -1851,11 +1851,11 @@ internal override void Bind_Blob(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, byte[] blobData) { SQLiteStatementHandle handle = stmt._sqlite_stmt; - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, blobData); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_blob(handle, index, blobData, blobData.Length, (IntPtr)(-1)); @@ -1864,11 +1864,11 @@ internal override void Bind_Null(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index) { SQLiteStatementHandle handle = stmt._sqlite_stmt; - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_null(handle, index); @@ -1878,11 +1878,11 @@ internal override int Bind_ParamCount(SQLiteStatement stmt, SQLiteConnectionFlags flags) { SQLiteStatementHandle handle = stmt._sqlite_stmt; int value = UnsafeNativeMethods.sqlite3_bind_parameter_count(handle); - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(HelperMethods.StringFormat( CultureInfo.CurrentCulture, @@ -1903,11 +1903,11 @@ name = UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name_interop(handle, index, ref len), len); #else name = UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name(handle, index), -1); #endif - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(HelperMethods.StringFormat( CultureInfo.CurrentCulture, @@ -1921,11 +1921,11 @@ internal override int Bind_ParamIndex(SQLiteStatement stmt, SQLiteConnectionFlags flags, string paramName) { SQLiteStatementHandle handle = stmt._sqlite_stmt; int index = UnsafeNativeMethods.sqlite3_bind_parameter_index(handle, ToUTF8(paramName)); - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(HelperMethods.StringFormat( CultureInfo.CurrentCulture, @@ -2537,14 +2537,14 @@ internal override void CreateModule(SQLiteModule module, SQLiteConnectionFlags flags) { if (module == null) throw new ArgumentNullException("module"); - if ((flags & SQLiteConnectionFlags.NoLogModule) != SQLiteConnectionFlags.NoLogModule) + if (HelperMethods.NoLogModule(flags)) { - module.LogErrors = ((flags & SQLiteConnectionFlags.LogModuleError) == SQLiteConnectionFlags.LogModuleError); - module.LogExceptions = ((flags & SQLiteConnectionFlags.LogModuleException) == SQLiteConnectionFlags.LogModuleException); + module.LogErrors = HelperMethods.LogModuleError(flags); + module.LogExceptions = HelperMethods.LogModuleException(flags); } if (_sql == null) throw new SQLiteException("connection has an invalid handle"); Index: System.Data.SQLite/SQLite3_UTF16.cs ================================================================== --- System.Data.SQLite/SQLite3_UTF16.cs +++ System.Data.SQLite/SQLite3_UTF16.cs @@ -258,11 +258,11 @@ break; } default: { #if !PLATFORM_COMPACTFRAMEWORK - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { SQLiteStatementHandle handle = (stmt != null) ? stmt._sqlite_stmt : null; LogBind(handle, index, dt); @@ -278,11 +278,11 @@ internal override void Bind_Text(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, string value) { SQLiteStatementHandle handle = stmt._sqlite_stmt; #if !PLATFORM_COMPACTFRAMEWORK - if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) + if (HelperMethods.LogBind(flags)) { LogBind(handle, index, value); } #endif Index: System.Data.SQLite/SQLiteConnection.cs ================================================================== --- System.Data.SQLite/SQLiteConnection.cs +++ System.Data.SQLite/SQLiteConnection.cs @@ -1978,11 +1978,11 @@ break; } } catch (Exception e) { - if ((_flags & SQLiteConnectionFlags.LogBackup) == SQLiteConnectionFlags.LogBackup) + if (HelperMethods.LogBackup(_flags)) { SQLiteLog.LogMessage(HelperMethods.StringFormat( CultureInfo.CurrentCulture, "Caught exception while backing up database: {0}", e)); } @@ -6309,17 +6309,16 @@ } catch (Exception e) /* NOTE: Must catch ALL. */ { try { - if ((_flags & SQLiteConnectionFlags.LogCallbackException) == - SQLiteConnectionFlags.LogCallbackException) + if (HelperMethods.LogCallbackExceptions(_flags)) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat(CultureInfo.CurrentCulture, - "Caught exception in \"Progress\" method: {1}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "Progress", e)); /* throw */ } } catch { // do nothing. @@ -6362,17 +6361,16 @@ } catch (Exception e) /* NOTE: Must catch ALL. */ { try { - if ((_flags & SQLiteConnectionFlags.LogCallbackException) == - SQLiteConnectionFlags.LogCallbackException) + if (HelperMethods.LogCallbackExceptions(_flags)) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat(CultureInfo.CurrentCulture, - "Caught exception in \"Authorize\" method: {1}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "Authorize", e)); /* throw */ } } catch { // do nothing. @@ -6411,17 +6409,16 @@ } catch (Exception e) /* NOTE: Must catch ALL. */ { try { - if ((_flags & SQLiteConnectionFlags.LogCallbackException) == - SQLiteConnectionFlags.LogCallbackException) + if (HelperMethods.LogCallbackExceptions(_flags)) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat(CultureInfo.CurrentCulture, - "Caught exception in \"Update\" method: {1}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "Update", e)); /* throw */ } } catch { // do nothing. @@ -6502,17 +6499,16 @@ } catch (Exception e) /* NOTE: Must catch ALL. */ { try { - if ((_flags & SQLiteConnectionFlags.LogCallbackException) == - SQLiteConnectionFlags.LogCallbackException) + if (HelperMethods.LogCallbackExceptions(_flags)) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat(CultureInfo.CurrentCulture, - "Caught exception in \"Trace\" method: {1}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "Trace", e)); /* throw */ } } catch { // do nothing. @@ -6564,17 +6560,16 @@ } catch (Exception e) /* NOTE: Must catch ALL. */ { try { - if ((_flags & SQLiteConnectionFlags.LogCallbackException) == - SQLiteConnectionFlags.LogCallbackException) + if (HelperMethods.LogCallbackExceptions(_flags)) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat(CultureInfo.CurrentCulture, - "Caught exception in \"Commit\" method: {1}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "Commit", e)); /* throw */ } } catch { // do nothing. @@ -6606,17 +6601,16 @@ } catch (Exception e) /* NOTE: Must catch ALL. */ { try { - if ((_flags & SQLiteConnectionFlags.LogCallbackException) == - SQLiteConnectionFlags.LogCallbackException) + if (HelperMethods.LogCallbackExceptions(_flags)) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat(CultureInfo.CurrentCulture, - "Caught exception in \"Rollback\" method: {1}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "Rollback", e)); /* throw */ } } catch { // do nothing. Index: System.Data.SQLite/SQLiteFunction.cs ================================================================== --- System.Data.SQLite/SQLiteFunction.cs +++ System.Data.SQLite/SQLiteFunction.cs @@ -414,17 +414,16 @@ } catch (Exception e) /* NOTE: Must catch ALL. */ { try { - if ((_flags & SQLiteConnectionFlags.LogCallbackException) == - SQLiteConnectionFlags.LogCallbackException) + if (HelperMethods.LogCallbackExceptions(_flags)) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat(CultureInfo.CurrentCulture, - "Caught exception in \"Invoke\" method: {0}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "Invoke", e)); /* throw */ } } catch { // do nothing. @@ -452,17 +451,16 @@ } catch (Exception e) /* NOTE: Must catch ALL. */ { try { - if ((_flags & SQLiteConnectionFlags.LogCallbackException) == - SQLiteConnectionFlags.LogCallbackException) + if (HelperMethods.LogCallbackExceptions(_flags)) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat(CultureInfo.CurrentCulture, - "Caught exception in \"Compare\" (UTF8) method: {0}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "Compare", e)); /* throw */ } } catch { // do nothing. @@ -499,17 +497,16 @@ } catch (Exception e) /* NOTE: Must catch ALL. */ { try { - if ((_flags & SQLiteConnectionFlags.LogCallbackException) == - SQLiteConnectionFlags.LogCallbackException) + if (HelperMethods.LogCallbackExceptions(_flags)) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat(CultureInfo.CurrentCulture, - "Caught exception in \"Compare\" (UTF16) method: {0}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "Compare (UTF16)", e)); /* throw */ } } catch { // do nothing. @@ -572,17 +569,16 @@ } catch (Exception e) /* NOTE: Must catch ALL. */ { try { - if ((_flags & SQLiteConnectionFlags.LogCallbackException) == - SQLiteConnectionFlags.LogCallbackException) + if (HelperMethods.LogCallbackExceptions(_flags)) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat(CultureInfo.CurrentCulture, - "Caught exception in \"Step\" method: {1}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "Step", e)); /* throw */ } } catch { // do nothing. @@ -627,17 +623,16 @@ } catch (Exception e) /* NOTE: Must catch ALL. */ { try { - if ((_flags & SQLiteConnectionFlags.LogCallbackException) == - SQLiteConnectionFlags.LogCallbackException) + if (HelperMethods.LogCallbackExceptions(_flags)) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat(CultureInfo.CurrentCulture, - "Caught exception in \"Final\" method: {1}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "Final", e)); /* throw */ } } catch { // do nothing. Index: System.Data.SQLite/SQLiteModule.cs ================================================================== --- System.Data.SQLite/SQLiteModule.cs +++ System.Data.SQLite/SQLiteModule.cs @@ -5587,11 +5587,11 @@ { /* throw */ SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat( CultureInfo.CurrentCulture, - "Caught exception in \"{0}\" method: {1}", + UnsafeNativeMethods.ExceptionMessageFormat, destroy ? "xDestroy" : "xDisconnect", e)); } } catch { @@ -5695,12 +5695,12 @@ if (logExceptions) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat( CultureInfo.CurrentCulture, - "Caught exception in \"SetTableError\" method: {0}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "SetTableError", e)); /* throw */ } } catch { // do nothing. @@ -8151,12 +8151,12 @@ if (LogExceptionsNoThrow) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, HelperMethods.StringFormat( CultureInfo.CurrentCulture, - "Caught exception in \"Dispose\" method: {0}", - e)); /* throw */ + UnsafeNativeMethods.ExceptionMessageFormat, + "Dispose", e)); /* throw */ } } catch { // do nothing. Index: System.Data.SQLite/SQLiteStatement.cs ================================================================== --- System.Data.SQLite/SQLiteStatement.cs +++ System.Data.SQLite/SQLiteStatement.cs @@ -397,11 +397,11 @@ DbType objType = param.DbType; if ((obj != null) && (objType == DbType.Object)) objType = SQLiteConvert.TypeToDbType(obj.GetType()); - if ((_flags & SQLiteConnectionFlags.LogPreBind) == SQLiteConnectionFlags.LogPreBind) + if (HelperMethods.LogPreBind(_flags)) { IntPtr handle = _sqlite_stmt; SQLiteLog.LogMessage(HelperMethods.StringFormat( CultureInfo.CurrentCulture, Index: System.Data.SQLite/UnsafeNativeMethods.cs ================================================================== --- System.Data.SQLite/UnsafeNativeMethods.cs +++ System.Data.SQLite/UnsafeNativeMethods.cs @@ -283,10 +283,162 @@ ///////////////////////////////////////////////////////////////////////// #region Internal Methods /// + /// Determines if preparing a query should be logged. + /// + /// + /// The flags associated with the parent connection object. + /// + /// + /// Non-zero if the query preparation should be logged; otherwise, zero. + /// + internal static bool LogPrepare( + SQLiteConnectionFlags flags + ) + { + flags &= SQLiteConnectionFlags.LogPrepare; + return (flags == SQLiteConnectionFlags.LogPrepare); + } + + ///////////////////////////////////////////////////////////////////////// + /// + /// Determines if pre-parameter binding should be logged. + /// + /// + /// The flags associated with the parent connection object. + /// + /// + /// Non-zero if the pre-parameter binding should be logged; otherwise, + /// zero. + /// + internal static bool LogPreBind( + SQLiteConnectionFlags flags + ) + { + flags &= SQLiteConnectionFlags.LogPreBind; + return (flags == SQLiteConnectionFlags.LogPreBind); + } + + ///////////////////////////////////////////////////////////////////////// + /// + /// Determines if parameter binding should be logged. + /// + /// + /// The flags associated with the parent connection object. + /// + /// + /// Non-zero if the parameter binding should be logged; otherwise, zero. + /// + internal static bool LogBind( + SQLiteConnectionFlags flags + ) + { + flags &= SQLiteConnectionFlags.LogBind; + return (flags == SQLiteConnectionFlags.LogBind); + } + + ///////////////////////////////////////////////////////////////////////// + /// + /// Determines if an exception in a native callback should be logged. + /// + /// + /// The flags associated with the parent connection object. + /// + /// + /// Non-zero if the exception should be logged; otherwise, zero. + /// + internal static bool LogCallbackExceptions( + SQLiteConnectionFlags flags + ) + { + flags &= SQLiteConnectionFlags.LogCallbackException; + return (flags == SQLiteConnectionFlags.LogCallbackException); + } + + ///////////////////////////////////////////////////////////////////////// + /// + /// Determines if backup API errors should be logged. + /// + /// + /// The flags associated with the parent connection object. + /// + /// + /// Non-zero if the backup API error should be logged; otherwise, zero. + /// + internal static bool LogBackup( + SQLiteConnectionFlags flags + ) + { + flags &= SQLiteConnectionFlags.LogBackup; + return (flags == SQLiteConnectionFlags.LogBackup); + } + +#if INTEROP_VIRTUAL_TABLE + ///////////////////////////////////////////////////////////////////////// + /// + /// Determines if logging for the class is + /// disabled. + /// + /// + /// The flags associated with the parent connection object. + /// + /// + /// Non-zero if logging for the class is + /// disabled; otherwise, zero. + /// + internal static bool NoLogModule( + SQLiteConnectionFlags flags + ) + { + flags &= SQLiteConnectionFlags.NoLogModule; + return (flags == SQLiteConnectionFlags.NoLogModule); + } + + ///////////////////////////////////////////////////////////////////////// + /// + /// Determines if errors should be logged. + /// + /// + /// The flags associated with the parent connection object. + /// + /// + /// Non-zero if the error should be logged; + /// otherwise, zero. + /// + internal static bool LogModuleError( + SQLiteConnectionFlags flags + ) + { + flags &= SQLiteConnectionFlags.LogModuleError; + return (flags == SQLiteConnectionFlags.LogModuleError); + } + + ///////////////////////////////////////////////////////////////////////// + /// + /// Determines if exceptions should be + /// logged. + /// + /// + /// The flags associated with the parent connection object. + /// + /// + /// Non-zero if the exception should be + /// logged; otherwise, zero. + /// + internal static bool LogModuleException( + SQLiteConnectionFlags flags + ) + { + flags &= SQLiteConnectionFlags.LogModuleException; + return (flags == SQLiteConnectionFlags.LogModuleException); + } +#endif + + ///////////////////////////////////////////////////////////////////////// + /// /// Determines if the current process is running on one of the Windows /// [sub-]platforms. /// /// /// Non-zero when running on Windows; otherwise, zero. @@ -606,10 +758,15 @@ #if !PLATFORM_COMPACTFRAMEWORK [SuppressUnmanagedCodeSecurity] #endif internal static class UnsafeNativeMethods { + public const string ExceptionMessageFormat = + "Caught exception in \"{0}\" method: {1}"; + + ///////////////////////////////////////////////////////////////////////// + #region Shared Native SQLite Library Pre-Loading Code #region Private Constants /// /// The file extension used for dynamic link libraries. ///