On Sat, Mar 5, 2016 at 10:43 PM, Domingo Alvarez Duarte < sqlite-mail at dev.dadbiz.es> wrote:
> Hello ! > > There is an user pointer that you pass and you can get it back using > https://www.sqlite.org/c3ref/user_data.html ! > i've got that, but that user data pointer is my callback function. The callback doesn't have a way to know if aggregation is just starting, though, so it doesn't know (except in the final() call) that it can reset its internal state. The scenario i'm concerned about is that sqlite calls my aggregate N times, then an error is triggered elsewhere which keeps sqlite from making the final() aggregate call. Currently i reset my accumulation state in the final() bits, but if final() is never called, then the _next_ time someone calls the aggregate, it will still have accumulated state from the previous attempt which failed partway through. -- ----- stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal "Freedom is sloppy. But since tyranny's the only guaranteed byproduct of those who insist on a perfect world, freedom will have to do." -- Bigby Wolf