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

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

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

            if (func != null)
            {
                _update_hook = new update_hook_info(func, v);
                SQLite3RuntimeProvider.sqlite3_update_hook(db.ToInt64(), Marshal.GetFunctionPointerForDelegate(new callback_update(update_hook_bridge)).ToInt64(), _update_hook.ptr.ToInt64());
            }
            else
            {
                SQLite3RuntimeProvider.sqlite3_update_hook(db.ToInt64(), IntPtr.Zero.ToInt64(), IntPtr.Zero.ToInt64());
            }
        }
        void ISQLite3Provider.sqlite3_update_hook(IntPtr db, delegate_update func, object v)
        {
            if (_update_hook != null)
            {
                // TODO maybe turn off the hook here, for now
                _update_hook.free();
                _update_hook = null;
            }

            if (func != null)
            {
                _update_hook = new update_hook_info(func, v);
                NativeMethods.sqlite3_update_hook(db, update_hook_bridge, _update_hook.ptr);
            }
            else
            {
                NativeMethods.sqlite3_update_hook(db, null, IntPtr.Zero);
            }
        }
Exemple #5
0
        static private void update_hook_bridge(IntPtr p, int typ, IntPtr db, IntPtr tbl, long rowid)
        {
            update_hook_info hi = update_hook_info.from_ptr(p);

            hi.call(typ, util.from_utf8(db), util.from_utf8(tbl), rowid);
        }
        void ISQLite3Provider.sqlite3_update_hook(IntPtr db, delegate_update func, object v)
        {
            if (_update_hook != null)
            {
                // TODO maybe turn off the hook here, for now
                _update_hook.free();
                _update_hook = null;
            }

            if (func != null)
            {
                _update_hook = new update_hook_info(func, v);
                SQLite3RuntimeProvider.sqlite3_update_hook(db.ToInt64(), Marshal.GetFunctionPointerForDelegate(new callback_update(update_hook_bridge)).ToInt64(), _update_hook.ptr.ToInt64());
            }
            else
            {
                SQLite3RuntimeProvider.sqlite3_update_hook(db.ToInt64(), IntPtr.Zero.ToInt64(), IntPtr.Zero.ToInt64());
            }
        }