internal override void ReturnBlob(SqliteContextHandle context, byte[] value) { UnsafeNativeMethods.sqlite3_result_blob(context, value, value.Length, null); }
internal override int ContextCollateCompare(CollationEncodingEnum enc, SqliteContextHandle context, char[] c1, char[] c2) { throw new NotImplementedException(); }
internal override CollationSequence GetCollationSequence(SqliteFunction func, SqliteContextHandle context) { throw new NotImplementedException(); }
internal abstract int ContextCollateCompare(CollationEncodingEnum enc, SqliteContextHandle context, string s1, string s2);
/// <summary> /// An internal aggregate Final function callback, which wraps the context pointer and calls the virtual Final() method. /// </summary> /// <param name="context">A raw context pointer</param> internal void FinalCallback(SqliteContextHandle context) { SqliteValueHandle n = (SqliteValueHandle)_base.AggregateContext(context); object obj = null; if (_contextDataList.ContainsKey(n)) { obj = _contextDataList[n]._data; _contextDataList.Remove(n); } _context = context; SetReturnValue(context, Final(obj)); IDisposable disp = obj as IDisposable; if (disp != null) disp.Dispose(); }
internal override void ReturnInt64(SqliteContextHandle context, long value) { UnsafeNativeMethods.sqlite3_result_int64(context, value); }
internal override void ReturnText(SqliteContextHandle context, string value) { UnsafeNativeMethods.sqlite3_result_text(context, value, value.Length, null); }
internal abstract void ReturnNull(SqliteContextHandle context);
internal abstract void ReturnText(SqliteContextHandle context, string value);
internal abstract void ReturnDouble(SqliteContextHandle context, double value);
internal abstract void ReturnInt64(SqliteContextHandle context, Int64 value);
internal abstract void ReturnBlob(SqliteContextHandle context, byte[] value);
internal abstract SqliteValueHandle AggregateContext(SqliteContextHandle context);
internal abstract int ContextCollateCompare(CollationEncodingEnum enc, SqliteContextHandle context, char[] c1, char[] c2);
internal override void ReturnDouble(SqliteContextHandle context, double value) { UnsafeNativeMethods.sqlite3_result_double(context, value); }
/// <summary> /// Takes the return value from Invoke() and Final() and figures out how to return it to SQLite's context. /// </summary> /// <param name="context">The context the return value applies to</param> /// <param name="returnValue">The parameter to return to SQLite</param> void SetReturnValue(SqliteContextHandle context, object returnValue) { if (returnValue == null || returnValue == DBNull.Value) { _base.ReturnNull(context); return; } Type t = returnValue.GetType(); if (t == typeof(DateTime)) { _base.ReturnText(context, _base.ToString((DateTime)returnValue)); return; } else { Exception r = returnValue as Exception; if (r != null) { _base.ReturnError(context, r.Message); return; } } switch (SqliteConvert.TypeToAffinity(t)) { case TypeAffinity.Null: _base.ReturnNull(context); return; case TypeAffinity.Int64: _base.ReturnInt64(context, Convert.ToInt64(returnValue, CultureInfo.CurrentCulture)); return; case TypeAffinity.Double: _base.ReturnDouble(context, Convert.ToDouble(returnValue, CultureInfo.CurrentCulture)); return; case TypeAffinity.Text: _base.ReturnText(context, returnValue.ToString()); return; case TypeAffinity.Blob: _base.ReturnBlob(context, (byte[])returnValue); return; } }
internal override void ReturnError(SqliteContextHandle context, string value) { UnsafeNativeMethods.sqlite3_result_error(context, ToUTF8(value), value.Length); }
/// <summary> /// Internal scalar callback function, which wraps the raw context pointer and calls the virtual Invoke() method. /// </summary> /// <param name="context">A raw context pointer</param> /// <param name="nArgs">Number of arguments passed in</param> /// <param name="argsptr">A pointer to the array of arguments</param> internal void ScalarCallback(SqliteContextHandle context, int nArgs, SqliteValueHandle[] argsptr) { _context = context; SetReturnValue(context, Invoke(ConvertParams(nArgs, argsptr))); }
internal override void ReturnNull(SqliteContextHandle context) { UnsafeNativeMethods.sqlite3_result_null(context); }
/// <summary> /// The internal aggregate Step function callback, which wraps the raw context pointer and calls the virtual Step() method. /// </summary> /// <remarks> /// This function takes care of doing the lookups and getting the important information put together to call the Step() function. /// That includes pulling out the user's contextData and updating it after the call is made. We use a sorted list for this so /// binary searches can be done to find the data. /// </remarks> /// <param name="context">A raw context pointer</param> /// <param name="nArgs">Number of arguments passed in</param> /// <param name="argsptr">A pointer to the array of arguments</param> internal void StepCallback(SqliteContextHandle context, int nArgs, SqliteValueHandle[] argsptr) { SqliteValueHandle nAux; AggregateData data; nAux = (SqliteValueHandle)_base.AggregateContext(context); if (_contextDataList.TryGetValue(nAux, out data) == false) { data = new AggregateData(); _contextDataList[nAux] = data; } try { _context = context; Step(ConvertParams(nArgs, argsptr), data._count, ref data._data); } finally { data._count++; } }
internal override SqliteValueHandle AggregateContext(SqliteContextHandle context) { return UnsafeNativeMethods.sqlite3_aggregate_context(context, 1); }
internal abstract CollationSequence GetCollationSequence(SqliteFunction func, SqliteContextHandle context);