Re: [sqlite] Implementing aggregate user functions

2004-12-07 Thread Roger Binns
Of course, avg() is already in the spec, so this isn't the 'perfect' instance, You can easily maintain an average as you see each row at the cost of more divisions. (eg for the 9th item add one ninth of the difference between the item and the running average to the average). Calculating a media

RE: [sqlite] Implementing aggregate user functions

2004-12-07 Thread Keith Herold
-Original Message- From: Roger Binns [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 7:26 PM To: [EMAIL PROTECTED] Subject: Re: [sqlite] Implementing aggregate user functions > new API function. But I am loath to add new API functions without > good reason and I do not c

Re: [sqlite] Implementing aggregate user functions

2004-12-06 Thread Roger Binns
new API function. But I am loath to add new API functions without good reason and I do not consider performance optimization of an exception condition a good reason. So you are going to have to argue very hard to get such a thing implemented. My motivation isn't based on performance, but on corre

Re: [sqlite] Implementing aggregate user functions

2004-12-06 Thread D. Richard Hipp
Roger Binns wrote: xFinal is always called. That makes life easier. Is it possible to tell if xFinal wants real results back versus there was an error earlier and I only need to cleanup. It is not possible at this time. xFinal called for cleanup purposes only is an exception condition. One do

Re: [sqlite] Implementing aggregate user functions

2004-12-06 Thread Roger Binns
xFinal is always called. That makes life easier. Is it possible to tell if xFinal wants real results back versus there was an error earlier and I only need to cleanup. Roger

Re: [sqlite] Implementing aggregate user functions

2004-12-06 Thread D. Richard Hipp
Roger Binns wrote: It isn't 100% clear to me what the semantics are for implementing aggregate user functions. The sqlite3_create_function call shows that they are done via xStep and xFinal callbacks. I assume that xStep is called for each relevant row. When is xFinal called? If xFinal is always