static void countFinalize( sqlite3_context context ) { CountCtx p = new CountCtx(); p.Context = sqlite3_aggregate_context( context, 0 ); sqlite3_result_int64( context, p != null ? p.n : 0 ); }
/* ** Routines to implement the count() aggregate function. */ static void countStep( sqlite3_context context, int argc, sqlite3_value[] argv ) { CountCtx p = new CountCtx(); p.Context = sqlite3_aggregate_context( context, 1 );//sizeof(*p)); if ( ( argc == 0 || SQLITE_NULL != sqlite3_value_type( argv[0] ) ) && p.Context != null ) { p.n++; } #if !SQLITE_OMIT_DEPRECATED /* The sqlite3_aggregate_count() function is deprecated. But just to make ** sure it still operates correctly, verify that its count agrees with our ** internal count when using count(*) and when the total count can be ** expressed as a 32-bit integer. */ Debug.Assert( argc == 1 || p == null || p.n > 0x7fffffff || p.n == sqlite3_aggregate_count( context ) ); #endif }
static void countFinalize(sqlite3_context context) { CountCtx p = new CountCtx(); p.Context = sqlite3_aggregate_context(context, 0); sqlite3_result_int64(context, p.n); if (p.Context != null) { p.Context.z = null; } }