internal void free() { _func_step = null; _func_final = null; _user_data = null; _h.Free(); }
internal agg_function_hook_info(delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final, object user_data) { _func_step = func_step; _func_final = func_final; _user_data = user_data; _h = GCHandle.Alloc(this); }
public function_hook_info( delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final, object user_data ) { _func_step = func_step; _func_final = func_final; _user_data = user_data; }
int ISQLite3Provider.sqlite3_create_function(IntPtr db, string name, int nargs, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final) { throw new Exception(GRIPE); }
static public int sqlite3_create_function(sqlite3 db, string name, int nArg, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final) { return(_imp.sqlite3_create_function(db.ptr, name, nArg, v, func_step, func_final)); }
static public int sqlite3_create_function(sqlite3 db, string name, int nArg, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final) { return _imp.sqlite3_create_function(db.ptr, name, nArg, v, func_step, func_final); }
int ISQLite3Provider.sqlite3_create_function (IntPtr db, string name, int nargs, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final) { // the keys for this dictionary are nargs.name, not just the name string key = string.Format ("{0}.{1}", nargs, name); var info = hooks.getOrCreateFor (db); if (info.agg.ContainsKey (key)) { agg_function_hook_info hi = info.agg [key]; // TODO maybe turn off the hook here, for now hi.free (); info.agg.Remove (key); } // 1 is SQLITE_UTF8 if (func_step != null) { // TODO both func_step and func_final must be non-null agg_function_hook_info hi = new agg_function_hook_info (func_step, func_final, v); int rc = NativeMethods.sqlite3_create_function_v2 (db, util.to_utf8 (name), nargs, 1, hi.ptr, null, agg_function_hook_bridge_step, agg_function_hook_bridge_final, null); if (rc == 0) { info.agg [key] = hi; } return rc; } else { return NativeMethods.sqlite3_create_function_v2 (db, util.to_utf8 (name), nargs, 1, IntPtr.Zero, null, null, null, null); } }
public static void create_function(this sqlite3 db, string name, int nargs, object v, delegate_function_aggregate_step f_step, delegate_function_aggregate_final f_final) { int rc = raw.sqlite3_create_function(db, name, nargs, v, f_step, f_final); check_ok(rc); }
public int sqlite3_create_function(IntPtr db, string name, int nArg, int flags, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final) => throw new NotImplementedException();
int ISQLite3Provider.sqlite3_create_function(IntPtr db, string name, int nargs, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final) { string key = string.Format("{0}.{1}", nargs, name); if (_agg_functions.ContainsKey(key)) { agg_function_hook_info hi = _agg_functions[key]; // TODO maybe turn off the hook here, for now hi.free(); _agg_functions.Remove(key); } GCHandle pinned = GCHandle.Alloc(util.to_utf8(name), GCHandleType.Pinned); IntPtr ptr = pinned.AddrOfPinnedObject(); int rc; // 1 is SQLITE_UTF8 if (func_step != null) { // TODO both func_step and func_final must be non-null agg_function_hook_info hi = new agg_function_hook_info(func_step, func_final, v); rc = SQLite3RuntimeProvider.sqlite3_create_function_v2(db.ToInt64(), ptr.ToInt64(), nargs, 1, hi.ptr.ToInt64(), 0, Marshal.GetFunctionPointerForDelegate(new callback_agg_function_step(agg_function_hook_bridge_step)).ToInt64(), Marshal.GetFunctionPointerForDelegate(new callback_agg_function_final(agg_function_hook_bridge_final)).ToInt64(), 0); if (rc == 0) { _agg_functions[key] = hi; } } else { rc = SQLite3RuntimeProvider.sqlite3_create_function_v2(db.ToInt64(), ptr.ToInt64(), nargs, 1, 0, 0, 0, 0, 0); } pinned.Free(); return(rc); }
int ISQLite3Provider.sqlite3_create_function(IntPtr db, string name, int nargs, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final) { // the keys for this dictionary are nargs.name, not just the name string key = string.Format("{0}.{1}", nargs, name); var info = hooks.getOrCreateFor(db); if (info.agg.ContainsKey(key)) { agg_function_hook_info hi = info.agg[key]; // TODO maybe turn off the hook here, for now hi.free(); info.agg.Remove(key); } GCHandle pinned = GCHandle.Alloc(util.to_utf8(name), GCHandleType.Pinned); IntPtr ptr = pinned.AddrOfPinnedObject(); int rc; // 1 is SQLITE_UTF8 if (func_step != null) { // TODO both func_step and func_final must be non-null agg_function_hook_info hi = new agg_function_hook_info(func_step, func_final, v); rc = SQLite3RuntimeProvider.sqlite3_create_function_v2(db.ToInt64(), ptr.ToInt64(), nargs, 1, hi.ptr.ToInt64(), 0, Marshal.GetFunctionPointerForDelegate(agg_function_hook_bridge_step).ToInt64(), Marshal.GetFunctionPointerForDelegate(agg_function_hook_bridge_final).ToInt64(), 0); if (rc == 0) { info.agg[key] = hi; } } else { rc = SQLite3RuntimeProvider.sqlite3_create_function_v2(db.ToInt64(), ptr.ToInt64(), nargs, 1, 0, 0, 0, 0, 0); } pinned.Free(); return rc; }