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

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

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

            if (func != null)
            {
                _trace_hook = new trace_hook_info(func, v);
                SQLite3RuntimeProvider.sqlite3_trace(db.ToInt64(), Marshal.GetFunctionPointerForDelegate(new callback_trace(trace_hook_bridge)).ToInt64(), _trace_hook.ptr.ToInt64());
            }
            else
            {
                SQLite3RuntimeProvider.sqlite3_trace(db.ToInt64(), IntPtr.Zero.ToInt64(), IntPtr.Zero.ToInt64());
            }
        }
        void ISQLite3Provider.sqlite3_trace(IntPtr db, delegate_trace func, object v)
        {
            if (_trace_hook != null)
            {
                // TODO maybe turn off the hook here, for now
                _trace_hook.free();
                _trace_hook = null;
            }

            if (func != null)
            {
                _trace_hook = new trace_hook_info(func, v);
                NativeMethods.sqlite3_trace(db, trace_hook_bridge, _trace_hook.ptr);
            }
            else
            {
                NativeMethods.sqlite3_trace(db, null, IntPtr.Zero);
            }
        }
Example #5
0
        static private void trace_hook_bridge(IntPtr p, IntPtr s)
        {
            trace_hook_info hi = trace_hook_info.from_ptr(p);

            hi.call(util.from_utf8(s));
        }
        void ISQLite3Provider.sqlite3_trace(IntPtr db, delegate_trace func, object v)
        {
            if (_trace_hook != null)
            {
                // TODO maybe turn off the hook here, for now
                _trace_hook.free();
                _trace_hook = null;
            }

            if (func != null)
            {
                _trace_hook = new trace_hook_info(func, v);
                SQLite3RuntimeProvider.sqlite3_trace(db.ToInt64(), Marshal.GetFunctionPointerForDelegate(new callback_trace(trace_hook_bridge)).ToInt64(), _trace_hook.ptr.ToInt64());
            }
            else
            {
                SQLite3RuntimeProvider.sqlite3_trace(db.ToInt64(), IntPtr.Zero.ToInt64(), IntPtr.Zero.ToInt64());
            }
        }