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); }
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); }
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); } }
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)); }