Example #1
0
        public static commit_hook_info from_ptr(IntPtr p)
        {
            GCHandle         h  = (GCHandle)p;
            commit_hook_info hi = h.Target as commit_hook_info;

            return(hi);
        }
Example #2
0
        internal static commit_hook_info from_ptr(IntPtr p)
        {
            GCHandle         h  = (GCHandle)p;
            commit_hook_info hi = h.Target as commit_hook_info;

            // TODO assert(hi._h == h)
            return(hi);
        }
Example #3
0
        void ISQLite3Provider.sqlite3_commit_hook(IntPtr db, delegate_commit func, object v)
        {
            if (_commit_hook != null)
            {
                // TODO maybe turn off the hook here, for now
                _commit_hook.free();
                _commit_hook = null;
            }

            if (func != null)
            {
                _commit_hook = new commit_hook_info(func, v);
                SQLite3RuntimeProvider.sqlite3_commit_hook(db.ToInt64(), Marshal.GetFunctionPointerForDelegate(new callback_commit(commit_hook_bridge)).ToInt64(), _commit_hook.ptr.ToInt64());
            }
            else
            {
                SQLite3RuntimeProvider.sqlite3_commit_hook(db.ToInt64(), IntPtr.Zero.ToInt64(), IntPtr.Zero.ToInt64());
            }
        }
        void ISQLite3Provider.sqlite3_commit_hook(IntPtr db, delegate_commit func, object v)
        {
            if (_commit_hook != null)
            {
                // TODO maybe turn off the hook here, for now
                _commit_hook.free();
                _commit_hook = null;
            }

            if (func != null)
            {
                _commit_hook = new commit_hook_info(func, v);
                NativeMethods.sqlite3_commit_hook(db, commit_hook_bridge, _commit_hook.ptr);
            }
            else
            {
                NativeMethods.sqlite3_commit_hook(db, null, IntPtr.Zero);
            }
        }
Example #5
0
        static private int commit_hook_bridge(IntPtr p)
        {
            commit_hook_info hi = commit_hook_info.from_ptr(p);

            return(hi.call());
        }
        void ISQLite3Provider.sqlite3_commit_hook(IntPtr db, delegate_commit func, object v)
        {
            if (_commit_hook != null)
            {
                // TODO maybe turn off the hook here, for now
                _commit_hook.free();
                _commit_hook = null;
            }

            if (func != null)
            {
                _commit_hook = new commit_hook_info(func, v);
                SQLite3RuntimeProvider.sqlite3_commit_hook(db.ToInt64(), Marshal.GetFunctionPointerForDelegate(new callback_commit(commit_hook_bridge)).ToInt64(), _commit_hook.ptr.ToInt64());
            }
            else
            {
                SQLite3RuntimeProvider.sqlite3_commit_hook(db.ToInt64(), IntPtr.Zero.ToInt64(), IntPtr.Zero.ToInt64());
            }
        }