Example #1
0
        internal void call_step(IntPtr context, IntPtr agg_context, int num_args, IntPtr argsptr)
        {
            sqlite3_context ctx = get_context(context, agg_context);

            sqlite3_value[] a = new sqlite3_value[num_args];
            // TODO warning on the following line.  SizeOf(Type) replaced in .NET 4.5.1 with SizeOf<T>()
            int ptr_size = Marshal.SizeOf(typeof(IntPtr));

            for (int i = 0; i < num_args; i++)
            {
                IntPtr vp = Marshal.ReadIntPtr(argsptr, i * ptr_size);
                a[i] = new sqlite3_value(vp);
            }

            _func_step(ctx, _user_data, a);
        }
Example #2
0
 static public int sqlite3_value_type(sqlite3_value val)
 {
     return _imp.sqlite3_value_type(val.ptr);
 }
Example #3
0
 static public long sqlite3_value_int64(sqlite3_value val)
 {
     return _imp.sqlite3_value_int64(val.ptr);
 }
Example #4
0
 static public double sqlite3_value_double(sqlite3_value val)
 {
     return _imp.sqlite3_value_double(val.ptr);
 }
Example #5
0
 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);
 }
Example #6
0
 static public string sqlite3_value_text(sqlite3_value val)
 {
     return(_imp.sqlite3_value_text(val.ptr));
 }
Example #7
0
 static public long sqlite3_value_int64(sqlite3_value val)
 {
     return(_imp.sqlite3_value_int64(val.ptr));
 }
Example #8
0
 static public int sqlite3_value_bytes(sqlite3_value val)
 {
     return(_imp.sqlite3_value_bytes(val.ptr));
 }
Example #9
0
 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);
 }
Example #10
0
 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);
 }
Example #11
0
 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);
 }
Example #12
0
 private static void count_args(sqlite3_context ctx, object user_data, sqlite3_value[] args)
 {
     ctx.result_int(args.Length);
 }
Example #13
0
 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);
 }
Example #14
0
 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);
 }
Example #15
0
 static public string sqlite3_value_text(sqlite3_value val)
 {
     return _imp.sqlite3_value_text(val.ptr);
 }
Example #16
0
 static public byte[] sqlite3_value_blob(sqlite3_value val)
 {
     return(_imp.sqlite3_value_blob(val.ptr));
 }
Example #17
0
        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++;
        }
Example #18
0
 static public double sqlite3_value_double(sqlite3_value val)
 {
     return(_imp.sqlite3_value_double(val.ptr));
 }
Example #19
0
        internal void call_step(IntPtr context, IntPtr agg_context, int num_args, IntPtr argsptr)
        {
            sqlite3_context ctx = get_context(context, agg_context);

            sqlite3_value[] a = new sqlite3_value[num_args];
            // TODO warning on the following line.  SizeOf(Type) replaced in .NET 4.5.1 with SizeOf<T>()
            int ptr_size = Marshal.SizeOf(typeof(IntPtr));
            for (int i=0; i<num_args; i++)
            {
                IntPtr vp = Marshal.ReadIntPtr(argsptr, i * ptr_size);
                a[i] = new sqlite3_value(vp);
            }

            _func_step(ctx, _user_data, a);
        }
Example #20
0
 static public int sqlite3_value_type(sqlite3_value val)
 {
     return(_imp.sqlite3_value_type(val.ptr));
 }
Example #21
0
 static public byte[] sqlite3_value_blob(sqlite3_value val)
 {
     return _imp.sqlite3_value_blob(val.ptr);
 }
Example #22
0
 static public int sqlite3_value_bytes(sqlite3_value val)
 {
     return _imp.sqlite3_value_bytes(val.ptr);
 }
Example #23
0
 static public ReadOnlySpan <byte> sqlite3_value_blob(sqlite3_value val)
 {
     return(_imp.sqlite3_value_blob(val.ptr));
 }