/** * call-seq: * aggregate_context( func ) -> hash * * Returns the aggregate context for the given function. This context is a * Hash object that is allocated on demand and is available only to the * current invocation of the function. It may be used by aggregate functions * to accumulate data over multiple rows, prior to being finalized. * * The +func+ parameter must be an opaque function handle as given to the * callbacks for #create_aggregate. * * See #create_aggregate and #aggregate_count. */ static VALUE static_api_aggregate_context( VALUE module, VALUE func ) { sqlite_func *func_ptr; VALUE *ptr; GetFunc( func_ptr, func ); /* FIXME: pointers to VALUEs...how nice is the GC about this kind of * thing? Especially when someone else frees the memory? */ ptr = (VALUE*)sqlite_aggregate_context( func_ptr, sizeof(VALUE) ); if( *ptr == 0 ) *ptr = rb_hash_new(); return *ptr; }