public static object get_Auxdata(FuncContext fctx, int arg) { Debug.Assert(MutexEx.Held(fctx.S.Ctx.Mutex)); VdbeFunc vdbeFunc = fctx.VdbeFunc; if (vdbeFunc == null || arg >= vdbeFunc.AuxsLength || arg < 0) { return(null); } return(vdbeFunc.Auxs[arg].Aux); }
public static void set_Auxdata(FuncContext fctx, int args, object aux, Action delete) { if (args < 0) { goto failed; } Debug.Assert(MutexEx.Held(fctx.S.Ctx.Mutex)); VdbeFunc vdbeFunc = fctx.VdbeFunc; if (vdbeFunc == null || vdbeFunc.AuxsLength <= args) { int auxLength = (vdbeFunc != null ? vdbeFunc.AuxsLength : 0); int newSize = args; vdbeFunc = new VdbeFunc(); if (vdbeFunc == null) { goto failed; } fctx.VdbeFunc = vdbeFunc; vdbeFunc.Auxs[auxLength] = new VdbeFunc.AuxData(); vdbeFunc.AuxsLength = args + 1; vdbeFunc.Func = fctx.Func; } VdbeFunc.AuxData auxData = vdbeFunc.Auxs[args]; if (auxData.Aux != null && auxData.Aux is IDisposable) { (auxData.Aux as IDisposable).Dispose(); } auxData.Aux = aux; return; failed: if (aux != null && aux is IDisposable) { (aux as IDisposable).Dispose(); } }