示例#1
0
        internal static void CloseConnection(SQLiteConnectionHandle hdl, IntPtr db)
        {
            if ((hdl == null) || (db == IntPtr.Zero))
            {
                return;
            }

            try
            {
                // do nothing.
            }
            finally /* NOTE: Thread.Abort() protection. */
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (hdl.syncRoot)
#else
                lock (hdl)
#endif
                {
#if !SQLITE_STANDARD
                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_close_interop(db);
#else
                    ResetConnection(hdl, db, false);

                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_close(db);
#endif
                    if (n != SQLiteErrorCode.Ok)
                    {
                        throw new SQLiteException(n, GetLastError(hdl, db));
                    }
                }
            }
        }
示例#2
0
        internal static void CloseConnection(SQLiteConnectionHandle db)
        {
            lock (_lock)
            {
#if !SQLITE_STANDARD
                int n = UnsafeNativeMethods.sqlite3_close_interop(db);
#else
                ResetConnection(db);
                int n = UnsafeNativeMethods.sqlite3_close(db);
#endif
                if (n > 0)
                {
                    throw new SQLiteException(n, SQLiteLastError(db));
                }
            }
        }
示例#3
0
        internal static void CloseConnection(SQLiteConnectionHandle hdl, IntPtr db)
        {
            if ((hdl == null) || (db == IntPtr.Zero))
            {
                return;
            }
            lock (hdl)
            {
#if !SQLITE_STANDARD
                int n = UnsafeNativeMethods.sqlite3_close_interop(db);
#else
                ResetConnection(hdl, db);
                int n = UnsafeNativeMethods.sqlite3_close(db);
#endif
                if (n > 0)
                {
                    throw new SQLiteException(n, GetLastError(hdl, db));
                }
            }
        }