On Thu, Mar 31, 2016 at 6:39 AM, Olivier Mascia <om at integral.be> wrote:
> > Le 31 mars 2016 ? 11:03, Clemens Ladisch <clemens at ladisch.de> a ?crit : > >> I think it is obvious I could build a SQL statement from within the > >> function and execute it. But it sounds costly to involve the parser > >> (yes, it's fast) for that, isn't it? > > > > You can prepare the statement beforehand. > > Not really. Preparing the statement involves the connection object which > won't be known before function call. So preparation has to be done > dynamically. Did I really miss something here? Put your function's persistent storage in the void*pApp passed to sqlite3_create_function(), then get it back using sqlite3_user_data(ctx). If the user_data is per-db, then you can have per-db state in there. -scott