예제 #1
0
        /// <summary>
        /// Returns the error message for the specified SQLite return code.
        /// </summary>
        /// <param name="errorCode">The SQLite return code.</param>
        /// <returns>The error message or null if it cannot be found.</returns>
        private static string GetErrorString(
            SQLiteErrorCode errorCode
            )
        {
#if !PLATFORM_COMPACTFRAMEWORK
            //
            // HACK: This must be done via reflection in order to prevent
            //       the RuntimeHelpers.PrepareDelegate method from over-
            //       eagerly attempting to locate the new (and optional)
            //       sqlite3_errstr() function in the SQLite core library
            //       because it happens to be in the static call graph for
            //       the AppDomain.DomainUnload event handler registered
            //       by the SQLiteLog class.
            //
            BindingFlags flags = BindingFlags.Static |
                                 BindingFlags.NonPublic | BindingFlags.InvokeMethod;

            return(typeof(SQLiteBase).InvokeMember("GetErrorString",
                                                   flags, null, null, new object[] { errorCode }) as string);
#else
            return(SQLiteBase.GetErrorString(errorCode));
#endif
        }