public static SqliteValueHandle sqlite3_aggregate_context(SqliteContextHandle context, int nBytes) { throw new System.NotImplementedException(); }
/// <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; } }
/// <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 abstract void ReturnNull(SqliteContextHandle context);
internal abstract void ReturnInt64(SqliteContextHandle context, Int64 value);
public static void sqlite3_result_text16(SqliteContextHandle statement, string value, int index, object dummy) { throw new System.NotImplementedException(); }
internal abstract SqliteValueHandle AggregateContext(SqliteContextHandle context);
public static void sqlite3_result_blob(SqliteContextHandle context, byte[] data, int dataLength, object callback) { var value = new System.Text.UnicodeEncoding().GetString(data, 0, data.Length); Community.CsharpSqlite.Sqlite3.sqlite3_result_blob(context.Handle, value, dataLength, null); }
public static void sqlite3_result_double(SqliteContextHandle context, double value) { Community.CsharpSqlite.Sqlite3.sqlite3_result_double(context.Handle, value); }
public static void sqlite3_result_null(SqliteContextHandle statement) { throw new System.NotImplementedException(); }
public static void sqlite3_result_int64(SqliteContextHandle statement, long value) { throw new System.NotImplementedException(); }
public static void sqlite3_result_error(SqliteContextHandle statement, string value, int index) { throw new System.NotImplementedException(); }
public static void sqlite3_result_double(SqliteContextHandle statement, double value) { throw new System.NotImplementedException(); }
public static void sqlite3_result_int64(SqliteContextHandle context, long value) { Community.CsharpSqlite.Sqlite3.sqlite3_result_int64(context.Handle, value); }
public static void sqlite3_result_null(SqliteContextHandle context) { Community.CsharpSqlite.Sqlite3.sqlite3_result_null(context.Handle); }
internal abstract int ContextCollateCompare(CollationEncodingEnum enc, SqliteContextHandle context, string s1, string s2);
public static void sqlite3_result_text(SqliteContextHandle context, string text, int textLength, object callback) { Community.CsharpSqlite.Sqlite3.sqlite3_result_text(context.Handle, text, textLength, null); }
internal abstract void ReturnDouble(SqliteContextHandle context, double value);
public static void sqlite3_result_error(SqliteContextHandle context, string error, int errorLength) { Community.CsharpSqlite.Sqlite3.sqlite3_result_error(context.Handle, error, errorLength); }
public static void sqlite3_result_blob(SqliteContextHandle context, byte[] value, int length, object dummy) { throw new System.NotImplementedException(); }
public static SqliteValueHandle sqlite3_aggregate_context(SqliteContextHandle context, int theByte) { var res = Community.CsharpSqlite.Sqlite3.sqlite3_aggregate_context(context.Handle, theByte); if (res == null) return null; return new SqliteValueHandle(res); }
public static void sqlite3_result_error16(SqliteContextHandle context, string error, int errorLength) { sqlite3_result_error(context, error, errorLength); }
/// <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))); }
public static void sqlite3_result_text16(SqliteContextHandle context, string value, int valueLength, object callback) { sqlite3_result_text(context, value, valueLength, null); }
/// <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 abstract CollationSequence GetCollationSequence(SqliteFunction func, SqliteContextHandle context);
internal abstract int ContextCollateCompare(CollationEncodingEnum enc, SqliteContextHandle context, char[] c1, char[] c2);
internal abstract void ReturnBlob(SqliteContextHandle context, byte[] value);
internal abstract void ReturnError(SqliteContextHandle context, string value);
internal abstract void ReturnText(SqliteContextHandle context, string value);