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 xStep.  The 
computation will be invalidated.  Will xStep be called again after it
raises an error?   Will xFinal be called?  If I know xFinal will be
called, ISTM I should raise an error there, too.  That would also
make xFinal a convenient place to reinitalize the data structures.  

Suppose xStep doesn't fail, but another query is executing
simultaneously, also using the median() UDF.  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?  

Many thanks for you guidance.  

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to