static public void sqlite3_result_zeroblob(sqlite3_context context, int n) { _imp.sqlite3_result_zeroblob(context.ptr, n); }
static public void sqlite3_result_error_nomem(sqlite3_context context) { _imp.sqlite3_result_error_nomem(context.ptr); }
static public void sqlite3_result_text(sqlite3_context context, string val) { _imp.sqlite3_result_text(context.ptr, val); }
static public void sqlite3_result_int(sqlite3_context context, int val) { _imp.sqlite3_result_int(context.ptr, val); }
private static void sum_plus_count_final(sqlite3_context ctx, object user_data) { if (ctx.state == null) { ctx.state = new my_state(); } my_state st = ctx.state as my_state; ctx.result_int64(st.sum + st.count); }
static public void sqlite3_result_null(sqlite3_context context) { _imp.sqlite3_result_null(context.ptr); }
private static void concat(sqlite3_context ctx, object user_data, sqlite3_value[] args) { string r = ""; foreach (sqlite3_value v in args) { r += v.value_text(); } ctx.result_text(r); }
static public void sqlite3_result_int64(sqlite3_context context, long val) { _imp.sqlite3_result_int64(context.ptr, val); }
static public void sqlite3_result_double(sqlite3_context context, double val) { _imp.sqlite3_result_double(context.ptr, val); }
static public void sqlite3_result_blob(sqlite3_context context, byte[] val) { _imp.sqlite3_result_blob(context.ptr, val); }
// TODO sqlite3_result_value static public void sqlite3_result_error_toobig(sqlite3_context context) { _imp.sqlite3_result_error_toobig(context.ptr); }
private static void len_as_blobs(sqlite3_context ctx, object user_data, sqlite3_value[] args) { int r = 0; foreach (sqlite3_value v in args) { if (v.value_type() != raw.SQLITE_NULL) { Assert.AreEqual(v.value_blob().Length, v.value_bytes()); r += v.value_blob().Length; } } ctx.result_int(r); }
private static void sum_plus_count_step(sqlite3_context ctx, object user_data, sqlite3_value[] args) { Assert.AreEqual(args.Length, 1); if (ctx.state == null) { ctx.state = new my_state(); } my_state st = ctx.state as my_state; st.sum += args[0].value_int64(); st.count++; }
static public void sqlite3_result_error_code(sqlite3_context context, int code) { _imp.sqlite3_result_error_code(context.ptr, code); }
// probably unnecessary since we pass user_data back as one of the // params to xFunc, xStep, and xFinal. static public object sqlite3_user_data(sqlite3_context context) { return context.user_data; }
private static void cube(sqlite3_context ctx, object user_data, sqlite3_value[] args) { Assert.AreEqual(args.Length, 1); long x = args[0].value_int64(); Assert.AreEqual(x, val); ctx.result_int64(x * x * x); }
private static void makeblob(sqlite3_context ctx, object user_data, sqlite3_value[] args) { byte[] b = new byte[args[0].value_int()]; for (int i=0; i<b.Length; i++) { b[i] = (byte) (i % 256); } ctx.result_blob(b); }
private static void mean(sqlite3_context ctx, object user_data, sqlite3_value[] args) { double d = 0; foreach (sqlite3_value v in args) { d += v.value_double(); } ctx.result_double(d / args.Length); }
private static void count_args(sqlite3_context ctx, object user_data, sqlite3_value[] args) { ctx.result_int(args.Length); }
private static void count_nulls(sqlite3_context ctx, object user_data, sqlite3_value[] args) { int r = 0; foreach (sqlite3_value v in args) { if (v.value_type() == raw.SQLITE_NULL) { r++; } } ctx.result_int(r); }
// probably unnecessary since we pass user_data back as one of the // params to xFunc, xStep, and xFinal. static public object sqlite3_user_data(sqlite3_context context) { return(context.user_data); }