Re: [sqlite] How to parameterize a loadable extension at runtime

2018-02-06 Thread Ulrich Telle
> Simon has the correct idea. If you have a function x(), you are free > to define another in the same extension called function > x_config(). Yes, of course. In fact, I mentioned this option already in my original post. The syntax for the user will be less intuitive than a pragma statement, b

Re: [sqlite] How to parameterize a loadable extension at runtime

2018-02-06 Thread petern
Simon has the correct idea. If you have a function x(), you are free to define another in the same extension called function x_config(). This x_config() function is free to change global runtime preference variables of the x() function based on the passed into the last call of x_config(). SQLI

Re: [sqlite] How to parameterize a loadable extension at runtime

2018-02-06 Thread Ulrich Telle
Dominique Devienne wrote: > > On Tue, Feb 6, 2018 at 11:15 AM, Ulrich Telle wrote: > > > > An alternative is to expose a virtual table with a fixed set of rows, and > > > accepting updates on the values, which can also then be "typed" too. > > > But that's a lot more complicated though. > > > (an

Re: [sqlite] How to parameterize a loadable extension at runtime

2018-02-06 Thread Dominique Devienne
On Tue, Feb 6, 2018 at 11:15 AM, Ulrich Telle wrote: > > An alternative is to expose a virtual table with a fixed set of rows, and > > accepting updates on the values, which can also then be "typed" too. > > But that's a lot more complicated though. > > (and refusing inserts/deletes too, of cours

Re: [sqlite] How to parameterize a loadable extension at runtime

2018-02-06 Thread Ulrich Telle
> Dominique Devienne wrote: > > An alternative is to expose a virtual table with a fixed set of rows, and > accepting updates on the values, which can also then be "typed" too. > But that's a lot more complicated though. > (and refusing inserts/deletes too, of course). > > That vtable could also

Re: [sqlite] How to parameterize a loadable extension at runtime

2018-02-06 Thread Simon Slavin
On 6 Feb 2018, at 9:24am, Ulrich Telle wrote: > Well, actually my goal is not to have an extension with non-deterministic > functions. The parameters have mostly the purpose to initialize the extension > (things similar to what you do to SQLite itself with pragmas like "PRAGMA > cache_size", o

Re: [sqlite] How to parameterize a loadable extension at runtime

2018-02-06 Thread Dominique Devienne
On Tue, Feb 6, 2018 at 9:44 AM, Simon Slavin wrote: > On 6 Feb 2018, at 8:33am, Ulrich Telle wrote: > > > Another possibility would be to add a user-defined function for the > > configuration of the extension that could be called from a SELECT > > statement: > > > > SELECT myextension_config('pa

Re: [sqlite] How to parameterize a loadable extension at runtime

2018-02-06 Thread Ulrich Telle
> Simon Slavin wrote: > > On 6 Feb 2018, at 8:33am, Ulrich Telle wrote: > > > Another possibility would be to add a user-defined function for the > > configuration of the extension that could be called from a SELECT > > statement: > > > > SELECT myextension_config('param-name', 'param-value');

Re: [sqlite] How to parameterize a loadable extension at runtime

2018-02-06 Thread Simon Slavin
On 6 Feb 2018, at 8:33am, Ulrich Telle wrote: > Another possibility would be to add a user-defined function for the > configuration of the extension that could be called from a SELECT > statement: > > SELECT myextension_config('param-name', 'param-value'); I've seen this done before. Of co

[sqlite] How to parameterize a loadable extension at runtime

2018-02-06 Thread Ulrich Telle
I have implemented a loadable SQLite extension. The behaviour of the extension can be configured by setting various parameters. Currently I select the parameter settings at compile time. However this is not very flexible. I would like to be able to modify the parameters at runtime. The most log