I believe It's private to that query as it is stored in sqlite3_context structure at the moment (the context being stored in a stack variable during SQL execution as far as I can tell). I'd assume this is stable behavior, but you'd have to ask the SQLite Dev team for an official answer. I aggree that the documentation isn't very clear.
Best regards, Peter ________________________________ From: Steinar Midtskogen <stei...@latinitas.org> To: General Discussion of SQLite Database <sqlite-users@sqlite.org> Sent: Mon, February 13, 2012 10:24:56 AM Subject: Re: [sqlite] Function context [Peter Aronson] > (2) You can associate data with an argument to a regular user-defined > function using sqlite3_set_auxdata() and sqlite3_get_auxdata() as long > as the value of the argument is static. If you don't normally have a > static argument to your function, you can add one (say a string > MAVG'). I actually used this approach with some application generated > SQL in my current project at one point. Thanks. I'm intending to write a function so I can do: SELECT unix_time, mavg(value, unix_time, <period>) FROM tab; assuming: CREATE TABLE tab (value REAL, unix_time INTEGER, PRIMARY KEY (unix_time)); So I assume that your second approach could work, since the third argument to mavg() (the period, window size in seconds) is static, e.g. mavg(value, unix_time, 86400) will give me the moving daily average. But will the data be private to only one query? That is, if two queries using the same period happen to run simultaniously, will it still work? The documentation wasn't clear. In its example of using this data for storing a compiled regexp, it would rather be useful if it was not strictly private. -- Steinar _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users