Re: [sqlite] per-context resources for user-defined function

2013-03-11 Thread James K. Lowden
On Mon, 11 Mar 2013 12:47:02 +0100 Clemens Ladisch wrote: > James K. Lowden wrote: > > I'm not sure how to manage the lifetime of ancillary data for a > > user-defined function added by sqlite3_create_function (). > > http://www.sqlite.org/c3ref/aggregate_context.html > > > Will xStep be called

Re: [sqlite] per-context resources for user-defined function

2013-03-11 Thread Ryan Johnson
On 11/03/2013 7:47 AM, Clemens Ladisch wrote: James K. Lowden wrote: I'm not sure how to manage the lifetime of ancillary data for a user-defined function added by sqlite3_create_function (). [...] Suppose xStep doesn't fail, but another query is executing simultaneously, also using the median()

Re: [sqlite] per-context resources for user-defined function

2013-03-11 Thread kyan
On Mon, Mar 11, 2013 at 12:52 PM, James K. Lowden wrote: > I need one data structure > per context. I don't see support for that in the SQLite API. Am I > expected to maintain my own global associative array? Not if you use sqlite3_aggregate_context(). See http://www.sqlite.org/c3ref/aggregate_

Re: [sqlite] per-context resources for user-defined function

2013-03-11 Thread Clemens Ladisch
James K. Lowden wrote: > I'm not sure how to manage the lifetime of ancillary data for a > user-defined function added by sqlite3_create_function (). > [...] > Suppose xStep doesn't fail, but another query is executing > simultaneously, also using the median() UDF. I need one data structure > per

[sqlite] per-context resources for user-defined function

2013-03-11 Thread James K. Lowden
Hello all, I'm not sure how to manage the lifetime of ancillary data for a user-defined function added by sqlite3_create_function (). Consider a median() function. The data are captured on each xStep, then sorted and the median produced in xFinal. Suppose sqlite3_realloc() fails during one