On Sat, Nov 9, 2019 at 1:20 PM Mario M. Westphal <m...@mwlabs.de> wrote:

> Thanks to all the friendly people who commented on my question. Much
> appreciated :-)
>
> I was able to solve this with a small trick:
> I created a small 'state' struct with a rowid and the result (float) for
> that row.
>

Sounds like you re-invented https://www.sqlite.org/c3ref/get_auxdata.html but
with global state, no?
I replied to your original thread with that link, before seeing this
message. Using the built-in SQLite
mechanism for function caching is much better, because it's clean, and
properly handles the lifetime
of the cache, tying it to the statement execution lifetime.

Of course, if you want to tie your cache to a longer lifetime, *across*
statement executions,
you can use a global cache independent of SQLite, as it seems you did, but
global state like
this is rarely a good idea in my experience :). YMMV. --DD
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to